kartik
kartik

Reputation: 191

What's the difference between build and release in flutter?

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.

Upvotes: 4

Views: 1894

Answers (2)

HasanToufiqAhamed
HasanToufiqAhamed

Reputation: 971

As of now, there are three main CPU architectures used in Android smartphones.

  • ARM: ARMv7 or armeabi
  • ARM64: AArch64 or arm64
  • x86: x86 or x86abi

flutter run --release compiles only for your connected devices ABI (Application Binary Interface). So, you can install that apk only those devices that can matched with your device only.

flutter build apk --release compiles for all architecture, that's why you can install your apk on any device or any CPU architectures.

Upvotes: 2

Bader-Eddine Qodia
Bader-Eddine Qodia

Reputation: 364

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)

Upvotes: 4

Related Questions