skip to Main Content

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


  1. 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:

    flutter build apk --release
    

    This will create a release build of your app in the build/app/outputs/apk directory.

    Login or Signup to reply.
  2. 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

    • Armeabi-v7a (ARM 32-bit)
    • Arm64-v8a (ARM 64-bit)
    • x86-64 (x86 64-bit)
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search