.NET 10 for Android: R8 Metadata (r8.json) and Google Play Code Optimization Reporting

Vinit Bhandari 0 Reputation points
2026-09-29T05:50:37.32+00:00

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:


<AndroidEnableCodeShrinking>true</AndroidEnableCodeShrinking>
<AndroidLinkTool>r8</AndroidLinkTool>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<PublishTrimmed>true</PublishTrimmed>

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:

  1. Does the released .NET 10 for Android workload support generating the r8.json metadata required by Google Play for code optimization reporting?
  2. If yes, what exact project configuration or MSBuild settings are required to generate r8.json?
  3. If r8.json is not generated with our current configuration, is this expected behavior for .NET 10 for Android?
  4. 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?
  5. 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
Developer technologies | .NET | .NET Multi-platform App UI
0 comments No comments

1 answer

Sort by: Oldest
  1. Nguyen Dam (WICLOUD CORPORATION) 505 Reputation points Microsoft External Staff Moderator
    2026-09-29T06:11:32.7366667+00:00

    Hello @Vinit Bhandari , 

    Thank you for providing the detailed information and for checking the contents of the generated AAB. 

    The r8.json file not being generated by the current .NET for Android workload is a known issue. This has been fixed, but the fix is not yet included in a released .NET 10 Android workload.  

    In the meantime, you can try the approach provided here to generate and include r8.json in your AAB: https://github.com/dotnet/android/pull/12646 

    Regarding your questions: 

    1. Does the released .NET 10 for Android workload support generating the r8.json metadata required by Google Play for code optimization reporting? 

    As of now, no. 

    2. If yes, what exact project configuration or MSBuild settings are required to generate r8.json? 

    Although the answer to the first question is no: you can still achieve this by using the workaround mentioned above.

    3. If r8.json is not generated with our current configuration, is this expected behavior for .NET 10 for Android? 

    If by "expected behavior" you mean whether .NET for Android is intended to work this way, then no. This is considered an issue, and a fix has already been merged. 

    If you mean whether r8.json not being generated is expected with the currently released .NET 10 Android workload, then yes, since that workload does not yet include the

    4. 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? 

    Since the fix has already been implemented, I would expect this to be supported in .NET 11. However, I cannot confirm this until the fix is included in a released .NET 11 Android workload 

    5. 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 -? 

    The fix is coming to .NET 10 through the release/10.0.1xx servicing branch, but the workload containing it has not been released yet. 

    If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation. Thank you. 

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.