I am using .NET 10 for Android with the following target framework:
Target Framework: net10.0-android36.0
We are working on optimizing the application according to Google's DEX code optimization requirements:
https://developer.android.com/topic/performance/issues/code-optimization
Current Release Configuration:
With this configuration, our uncompressed DEX size was reduced from approximately 26.9 MB to 13.7 MB.
However, Google Play/Android optimization reporting currently does not show any percentage for Shrinking / Optimization / Obfuscation.
For comparison, the previous build without the above R8 configuration was showing 1% for Obfuscation.
I have verified that our build currently generates the ProGuard/R8 mapping file (proguard.map), but I do not currently see r8.json in the generated output/AAB.
According to Google's documentation: [Reference Link: https://developer.android.com/google/play/vitals/code-optimization ]
- For apps built with the latest patch of AGP version 8.10 or higher, the optimization percentages are obtained from the included r8.json file.
- For lower AGP versions, or when r8.json is not included, the percentages can be calculated from mapping.txt when available, or using DEX heuristics when the mapping file is not available.
What we have already checked
We unzipped the generated Android App Bundle (.aab) and inspected the BUNDLE-METADATA directory.
For our current build, with the above R8 configuration the AAB contains the following:
BUNDLE-METADATA/com.android.tools.build.obfuscation/proguard.map
The proguard.map file is present and generated successfully.
However, we do not see an r8.json file anywhere in the generated AAB, including the BUNDLE-METADATA directory.
Based on the generated AAB contents, our current .NET 10 Android build is packaging the ProGuard/R8 mapping file, but we have not been able to get the r8.json R8 optimization metadata packaged into the AAB.
As a result, Google Play currently displays - for the Obfuscation percentage rather than a percentage.
I would like to know the following:
- Does the released .NET 10 for Android workload support generating the r8.json metadata required by Google Play for code optimization reporting?
- If yes, what exact project configuration or MSBuild settings are required to generate r8.json?
- If r8.json is not generated with our current configuration, is this expected behavior for .NET 10 for Android?
- Will .NET 11 generate and package r8.json in a way that Google Play can use it to display the Shrinking, Optimization and Obfuscation percentages?
- Most importantly: For a .NET for Android application, what is the earliest .NET Android version/workload where we can expect Google Play to receive the required R8 metadata and display the three optimization percentages instead of -?
Our main objective is to understand what needs to be done on the .NET Android build side so that Google Play can report Shrinking, Optimization, and Obfuscation percentages instead of -, while continuing to use R8 code shrinking.
Environment:
- .NET 10
- net10.0-android36.0
- Release build
- Android App Bundle (.aab)
- R8 enabled
- AndroidLinkMode=SdkOnly
- PublishTrimmed=true
- proguard.map: generated
- r8.json: currently not observed in the AAB
- DEX Size Before Optimization: ~26.9 MB
- DEX Size After Optimization: ~13.7 MB