I made a calculator app using flutter and when I generated the .aab file, it came out to be 16 MB! How do I reduce the size of my .aab file?
Regarding to the flutter official documentation.
Reducing app size
When building a release version of your app, consider using the --split-debug-info tag. This tag can dramatically reduce code size. For an example of using this tag, see Obfuscating Dart code.
Some other things you can do to make your app smaller are:
Remove unused resources
Minimize resource imported from libraries
Compress PNG and JPEG files
Build the .abb
Clean your project
flutter clean
Build an appbundle using the --split-debug-info tag
flutter build appbundle --obfuscate --split-debug-info=<the-path>
Note the <the-path>, a location where your app-release.aab will be copied.
Output
💪 Building with sound null safety 💪
Running Gradle task 'bundleRelease'... 94,8s
✓ Built build/app/outputs/bundle/release/app-release.aab (17.5MB).
Note that the final size of my app-release.aab is 17.5MB.
For more details recarding to deploy flutter android app read the official documentation.
Download size
After deploying my Flutter app to playstore, I was surprised to see that the download size is finally 6.4M.
This is a full app in production, not just a default flutter counter app. You can try it on playstore.
Related
I was developing a flutter application. So I had to delete unused assets used in the project(mainly images) to reduce app size. How can we achieve this in a better way?
Check out this tutorial by the Flutter team for information on how to reduce app size.
When you release app as appbundle it reduces by every architechture that's why you do not need doing this proccess.It would we automatically changed when user download apk from google play
You can try delete unused packages and it would be good too for size app.
When you run flutter build apk or flutter build apk --release app size very high when you try run this flutter build apk --split-per-abi app size will be reduced by architechture of processor. When you upload your project to store it will be required appbundle that why when you download app really from store it would show to reduced size app that's why dont worry.
Im building an apk and the size is too large bcz i just created a ui till now and the size is 49mb there is huge differnece .
in this image the upper apk size is 22mb which build is created 7months ago but now i reopen and just created build again the size is 47mb somehow facing this issue in all apps the size is getting larger.
Try with flutter released apk .
I also came across in this very apk condition when debugging, while in releases around 7-8 mb. This however we could see it in much larger apps, where natively speaking, we need to import many libraries, while with Flutter the work is optimized. So if we assume an app that natively should weigh around 30mb with Flutter it should be similar. What can scare you is in the very basic apps. The important thing however is to optimize the images.
After running flutter build apk --release, my APK size was 16.2 MB. This APK is called FAT APK which is a single APK that contains binaries for multiple ABIs embedded within it and supports multiple architectures. With flutter build apk --split-per-abi, dart code obsfucates resulting in 3 APK files, size of my app.APK was reduced to 5.6 MB.
I have recorded SkSl script to warmup shaders. I use this build option to apply it for my Flutter app's release builds:
flutter build appbundle --release --bundle-sksl-path flutter_01.sksl.json
It works great, but it stops work when new Flutter version released. In that case I have an error:
Expected Flutter b8752bbfff0419c8bf616b602bc59fd28f6a3d1b, but found 2c956a31c0a3d350827aee6c56bb63337c5b4e6e
The SkSL bundle was produced with a different engine version. It must be recreated for the current Flutter version.
I want to detect this error without building my release app (as a merge check on CI).
The question: is it possible?
My web folder after building my Flutter Web app comes to 5.4MB which isn't too bad, but I might as well optimize.
I was wondering if anybody has any tips outside the obvious(removing unnecessary packages), to minimize the file size? I'll be hosting on Firebase.
Also, there is a NOTICES file which is about 1MB filled with random licenses/copyright disclaimers, are there any consequences to deleting this?
Is flutter build web all you do to build a release version? Is there anything else that should be done other than flutter clean?
According to flutter document, There is a option available for all platforms
but not available for web so far. Read the full document
This command will help you to get a minimized size of build except web
flutter build apk --analyze-size
flutter build appbundle --analyze-size
flutter build ios --analyze-size
flutter build linux --analyze-size
flutter build macos --analyze-size
flutter build windows --analyze-size
I would like to know if the apk file produced from running the flutter run --release command is different from flutter build apk. Which is better for uploading to the playstore.? I just tried both commands and the difference in apk size is really huge. The release command produces a far smaller apk size.
In summary what I want to know is since
Flutter build apk =>> fat apk.
Does
Flutter run --release =>> split apk?
flutter run --release: builds a release version of the app and starts it directly, then shows the console UI to manipulate the running instance.source flutter wiki
Use release mode for deploying the app, when you want maximum optimization and minimal footprint size. For mobile, release mode (which is not supported on the simulator or emulator), means that:
Assertions are disabled.
Debugging information is stripped out.
Debugging is disabled.
Compilation is optimized for fast startup, fast execution, and small package sizes.
Service extensions are disabled.
(apps are smaller)
flutter build apk results in a fat which is a single APK that contains binaries for multiple ABIs embedded within it. This has the benefit that the single APK runs on multiple architectures and thus has wider compatibility, but it has the drawback that its file size is much larger, causing users to download and store more bytes when installing your application. When building APKs instead of app bundles, it is strongly recommended to build split APKs
Although app bundles are preferred over APKs, there are stores that don’t yet support app bundles
When should I build app bundles versus APKs?
The Google Play Store recommends that you deploy app bundles over APKs because they allow a more efficient delivery of the application to your users. However, if you’re distributing your application by means other than the Play Store, an APK may be your only option.
read more from the docs
You can split apks with this command
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi