Why is the size of my app nearly doubled after upgrading Flutter from 1.5 to 1.7.4?
The code is same, however, the APK size increased from 7.6 MB
to 14.2 MB
.
I am using flutter build apk
.
By default, launching your app with flutter run , or by clicking the Play button in your IDE (as used in Test drive and Write your first Flutter app), generates a debug build of the Flutter app. The app size of a debug build is large due to the debugging overhead that allows for hot reload and source-level debugging.
For splitting the apks, we run the command flutter build apk --split-per-abi . This should reduce the app size significantly.
The command “flutter build apk –split-per-abi” will build an archive of separated apks (one for each target architecture). If your app is very large or your users are in areas where they must pay for data, it is important to keep the APK size to a minimum. So it is recommended to use the ” –split-per-abi” option.
This behavior is in response to this Play Store warning.
Flutter now includes 32-bit and 64-bit binaries in APKs built using flutter build apk
by default which effectively doubles the APK size as it is a fat APK which contains binaries for both ABIs.
There are two ways you can go about reducing your APK size again:
flutter build appbundle
This option is the preferred way for the Play Store as you are able to upload a single file (that will be >14 MB
in your case) and the Play Store then builds different APKs for every device from the App Bundle, which means that the download size of the APK will be around 7 MB
.
Learn more.
flutter build apk --split-per-abi
This command will simply output two different APK files, one for 32-bit and one for 64-bit, each being about 7 MB
. However, this means that you will have to upload multiple files to the Play Store if you are using that to distribute your application.
Learn more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With