Search code examples
androidvisual-studioxamarinapk

Xamarin - Unable to publish to Google Store because of the Unoptimized APK warning


I am trying to publish my Android app to the Google store. I keep getting a warning message saying this:

Unoptimized APK Warning: This APK results in unused code and resources being sent to users. Your app could be smaller if you used the Android App Bundle. By not optimizing your app for device configurations, your app is larger to download and install on users' devices than it needs to be. Larger apps see lower install success rates and take up storage on users' devices. Resolution: Use the Android App Bundle to automatically optimize for device configurations, or manage it yourself with multiple APKs.

This 'warning' message is preventing me from publishing. The 'START ROLLOUT PRODUCTION' button is grayed out.

I got the latest Enterprise version Visual Studio 2019 16.2.3. Here are the items in the property page that have been checked:

Bundle assemblies into native code
Generate one package (.apk) per selected ABI
Enable Multi-Dex
Dex compile = d8
Code Shrinker = r8
Debugger = .Net (Xamarin)
AOT Compilation
Use LLVM Startup Treacing
Use the concurrent garbage collector
Linking = Sdk and user assemblies

I am supporting armeabi-v7a and arm64-v8a

I believe in the Android Package Signing I have the correct keystore and keystore passwords.

What do I need to do to get this to work? Should I try to use ProGuard? But I was having issues with it wasn't compiling. But isn't r8 a better way than ProGuard?


Solution

  • Well I created a aab file and submitted it to google and that caused the warning messages to go away. But the button 'START ROLLOUT PRODUCTION' was still grayed out. After about a hour of searching I found out that the email address for the app wasn't filled in.

    Google really needs better messages to tell you these things.

    Edit: I also was having many issues when I used the R8 code compressor. I switched to Proguard and that worked much better.