How to solve Google Play unoptimized APK problem on Flutter apps?
make sure you remove all the unwanted code from all the files and go through https://flutter.dev/docs/deployment/android this and maybe try "flutter build appbundle". Also, remove the permissions that aren't required by the app.
mirkancal
Software Engineer from Kyiv, Ukraine. Working professionally with Flutter for three years, started during my senior project, when Flutter was Alpha.
Updated on December 12, 2022Comments
-
mirkancal over 1 year
With my Flutter app, I get this error on Google Play
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.
I have added them in android/app/build.gradle but it didn't solve my issue:
buildTypes { release { signingConfig signingConfigs.release minifyEnabled true shrinkResources false useProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
-
Mariano Zorrilla almost 5 yearsthat warning doesn't affect the app in any way. Google recommends you to use bundles to avoid sending the full apk size to their users, that's it.
-
mirkancal almost 5 yearsHow can I proceed in google play?
-
chrish almost 5 years@mirkancal Does this warning prevent from publishing on Google Play?
-
mirkancal almost 5 years@chrish yes. Start rollout to production button is disabled for days.
-
chrish almost 5 years@mirkancal: We had this for a user. Their rollout was disable due to not being completely done with pricing and content rating, not on this. So there were no other changes to the account and then a couple days later rollout was enabled?
-
mirkancal almost 5 yearsI have green check marks on App releases, Store listing, Content rating, App content, Pricing & distribution but still no go on the button.
-
Silas S. Brown over 4 yearsI get this warning even on a simple app I wrote myself in Java (no libraries included), whose only resource is a launcher icon, and even that launcher icon is provided in only a single resolution, so absolutely no unused code or resources are sent to any users. Play Store's logic of when to say "This APK results in unused code and resources being sent to users" is obviously flawed, and there's no clear way to report this bug to Google (I'm concerned it could result in developers getting into the habit of ignoring all warnings without reading).
-
-
mirkancal almost 5 yearsWhen building app bundle, it give me error. I fixed it with this: github.com/flutter/flutter/issues/28979#issuecomment-476426976