BIS Tech
BIS Tech

Reputation: 19514

Is it possible to build one apk for 3 architectures?

Is it possible to build one apk for 3 architectures?

I am not talking about appBundle. Is there any way to build one apk for 3 architectues?

The app should be running any devices

arm64-v8a-release.apk
armeabi-v7a-release.apk
x86_64-release.apk

Upvotes: 1

Views: 587

Answers (2)

BIS Tech
BIS Tech

Reputation: 19514

just run flutter build apk

Note

Run flutter build apk --split-per-abi (The flutter build command defaults to --release.)

This command results in three APK files:

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

Removing the --split-per-abi flag 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.

Upvotes: 2

Karol Lisiewicz
Karol Lisiewicz

Reputation: 674

You can achieve this by specifing ABIs, which you can configue in the android/app/build.gradle file, for example:

release {
  ndk {
    abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
  }
}

The default behavior of the build system is to include the binaries for each ABI in a single APK, also known as a fat APK.

You can learn more on ABIs HERE.

Upvotes: 0

Related Questions