Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between 3 APKs generated from flutter?

I need to understand the Android device architecture and, Why there is three different types of APKs are generated when I use:

flutter build apk --split-per-abi.

And when I use

flutter build apk

I get a large APK file called fat APK contains the 3 versions of the app.

like image 476
Abdurrahman Anas Avatar asked Dec 14 '19 15:12

Abdurrahman Anas


People also ask

What is flutter APK?

APK (Application Package File) is a format used by Android operating systems for distribution and installation. After you build an application, it's quite common to build APK files to be tested across different devices.

Why does the first flutter app build take so long?

Why does the first Flutter app build take so long? When building a Flutter app for the first time, a device-specific APK or IPA file is built. Hence, Gradle and XCode are used to build the files, taking time.

What is split per ABI flutter?

The command “flutter build apk –split-per-abi” will build an archive of separated apks (one for each target architecture). If your app is very large or your users are in areas where they must pay for data, it is important to keep the APK size to a minimum. So it is recommended to use the ” –split-per-abi” option.


2 Answers

The command flutter build apk --split-per-abi typically generates two APK files.

  1. arm64 or x86_64 is the apk file for devices having 64-bit processors.
  2. x86 is the apk file for 32-bit processors.

You can upload both of them on the PlayStore and based on the user's device architecture the corresponding apk will be installed.

The fat apk that you are getting while using the flutter build apk contains the necessary compiled code to target all the Application Binary Interfaces or ABIs. Once a user downloads this fat apk, then only the code applicable to the device will be used.

like image 112
Kartik Shandilya Avatar answered Sep 28 '22 03:09

Kartik Shandilya


flutter build apk gives you large apk because,

flutter build apk results in a fat APK that contains your code compiled for all the target ABIs. Such APKs are larger in size than their split counterparts, causing the user to download native binaries that are not applicable to their device’s architecture.


--split-per-abi results in two APK files:

(The flutter build command defaults to --release.)

<app dir>/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
<app dir>/build/app/outputs/apk/release/app-arm64-v8a-release.apk

Where armeabi-v7a for is 32-bit devices and arm64-v8a for 64-bit devices.

Read More on
https://flutter.dev/docs/deployment/android#build-an-apk
https://flutter.dev/docs/deployment/android#build-an-app-bundle
https://developer.android.com/studio/build/configure-apk-splits#configure-split

like image 26
Ravinder Kumar Avatar answered Sep 28 '22 03:09

Ravinder Kumar