Why the size of flutter build apk --release
is larger than the size of flutter run --release
which reduces the size by half. I need to get the leaner app size.
Why the size of flutter build apk --release
is larger than the size of flutter run --release
which reduces the size by half. I need to get the leaner app size.
2
Answers
In Flutter, a build refers to the process of taking your source code and turning it into a deployable app. There are two types of builds in Flutter: debug builds and release builds.
Debug builds are used for development and testing. They are built with debugging symbols enabled, which makes it easier to debug your code. Debug builds also include a debugger that allows you to pause the execution of your code and inspect variables and the call stack.
Release builds are used for deploying your app to app stores or distributing it to users. They are built with debugging symbols stripped, which makes the app smaller and faster. Release builds also have optimizations enabled, which makes the app even faster.
To create a release build in Flutter, you can use the flutter build command with the –release flag. For example:
This will create a release build of your app in the build/app/outputs/apk directory.
We should know that
flutter run --release
compiles only for a target ABI (because you run the generated APK directly to your device). while,flutter build apk --release
results in a fat APK (Universal apk) that contains your code compiled for all the target ABIs, as a result, you could install this apk on any device.Flutter app can be compiled for