Flutter release apk - flutter

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

Related

Is there any way to identify unused asssets(images, files) in a flutter project?

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.

My Apk size getting much large after upgrading flutter to latest

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.

How to reduce the size of Flutter .aab file?

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.

Hybrid Application Sizes

Currently, I've been developing an application in flutter but after I install it on my android device I diagnosed that it takes huge amount of space.
Firstly I want to know if there is any solution to it?
Secondly, if there isn't any solution; is there any other hybrid language without this problem??
if you run flutter run and see the application size in your phone you will find it very large > 40 MB. This is because while in debug mode whole flutter engine is installed on phone to support debugging and Just in time compilation of your dart files. Effectively lets you hot reload your changes Just in time.
Now if you run flutter build apk or flutter run --release, this will generate an apk in release mode. Means no debugging support, everything Ahead of compiled to target machine code. And the size of the app should be as low as possible < 15 MB.

How to make multiplatform flutter apk release or app bundle for playstore upload

By multiplatform I mean arm64 and arm, using the default way of build a release apk it gives me an apk that works only on arm, but I can make an arm64 version by using the command
flutter build apk --release --target-platform --android-arm
The question is, how to make 1 apk for both platform or an app bundle that will work for play store?
I think is by using:
flutter build appbundle
Currently, if you're uploading an APK to the play store you need to upload multiple APKs for the architectures you're specifically targeting. You're able to create a "fat APK" which contains all the architectures however, it will increase the overall APK size.
As per the docs, it's recommended to use the app bundles as it will provide the required architecture depending on the device that downloads the app.
More info here: https://flutter.dev/docs/deployment/android
use this command in terminal ->flutter build apk --split-per-abi