Support R8 resource shrinking to reduce app size and resolve Play Console warnings
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- android, csharp
- Área
- build-system, mobile
Línea de trabajo
Start by reviewing the attached workaround and its setup instructions, then trace the Android SDK’s R8 invocation and AAB packaging path. The issue asks for a supported MSBuild property that preserves managed resources and R8 metadata; done means resource shrinking is enabled in Play Console, protected resource names and IDs remain unchanged, and bundle validation passes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Android framework version
net11.0-android (Preview)
Affected platform version
.NET SDK 11.0.100-rc.2.26504.105 Microsoft.Android.Sdk.Windows 37.2.0-rc.2.84 Bundled R8 9.4.24
Description
Following up on #5203, I’d like to request supported R8 resource shrinking in .NET for Android.
Even with R8 full mode and class repackaging enabled, Google Play Console warns that resource shrinking is disabled.
I tested a local MSBuild workaround across several NativeAOT projects and confirmed two benefits:
- Modest size reductions: approximately 75–182 KB per signed AAB and 114–214 KB in device-specific installed APK files.
- Play Console recognizes resource shrinking as enabled, resolving the warning about disabled resource shrinking.
The comparisons used matched builds with shrinking disabled/enabled. Native libraries, assets and manifests were identical within each pair. Installed APK measurements used an arm64 device profile and exclude app data, caches and Android-generated runtime files.
Could resource shrinking be exposed through a supported MSBuild property, with managed resource retention, packaging and R8 metadata handled by the SDK?
Steps to Reproduce
Observed with existing .NET 11 Android applications using NativeAOT:
- Build a Release AAB with PublishAot=true and AndroidLinkTool=r8, without custom resource-shrinking integration.
- Upload the signed AAB to Google Play Console.
- Inspect the bundle’s R8 configuration and optimization recommendations.
- Resource shrinking is shown as disabled, and Play Console recommends enabling it.
After adding custom resource-shrinking integration and uploading a new build, Play Console shows resource shrinking as enabled.
Did you find any workaround?
Yes. I implemented a local MSBuild integration using the bundled R8 resource shrinker.
It retains the SDK’s Java inputs, ProGuard rules, mapping and compiler-generated r8.json metadata. Since R8 cannot see managed resource access, it scans NativeAOT input assemblies and generates Java resource roots, conservatively preserving application resources and dynamic string lookups.
The shrunk resource archive is passed into normal AAB packaging and signing. After shrinking, AAPT verifies that protected resource names and IDs remain unchanged. Release builds and bundle validation passed for the tested projects.
Optimized resource shrinking remains disabled: R8 warned about the SDK-generated final Java R fields, so I have not validated that mode. Play Console now checks standard resource shrinking, while optimized resource shrinking remains unchecked.
The workaround depends on SDK implementation details, so built-in support would be preferable.
Attached is an anonymized, source-only version of the workaround, including setup instructions and required NativeAOT compatibility rules, validated with a separate minimal NativeAOT application.
- Lenguaje dominante
- C#
- Estrellas
- 2.1k
- Forks
- 579
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 249
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/android
-
Area: App+Library Build
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
EditText.getText() isn't boundAbiertoArea: Mono.Android
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
dotnet/android#9192 · 4 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
agentic-workflows needs-triage
Dificultad 4/5 1-2 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
[.NET 10 / .NET 11 RC2] Native JNI control blocks leak after peer finalizationPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoArea: App Runtime needs-triage
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
AndroidTypeMapImplementation trimmable removes types that are used in type castsPosiblemente ocupada @simonrozsival la tomó hace 1 día. AbiertoArea: App Runtime bug trimmable-type-map
dotnet/android#13286 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de dotnet/android
Issues similares
-
area-ai bug untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
dotnet/extensions#7893 ·
Los mantenedores suelen responder en 1 día
-
devtools documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
area-System.ComponentModel untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
dotnet/runtime#136608 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
fix: Cannot reopen dialog after closing with escape key in FluentDialogPosiblemente ocupada @bryan-ramirez la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/fluentui-blazor#5572 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sillsdev/languageforge-lexbox#2846 ·
Los mantenedores suelen responder en 1 día