Carrie
Carrie

Reputation: 77

flutter can not generate x86, x86_64 apk file

I want to generate apk file that support : 'armeabi-v7a','arm64-v8a','x86','x86_64'

I used the command :

flutter build apk --flavor production

and also

flutter build appbundle --target-platform android-arm,android-arm64

The result will always be only arm64-v8a, and armeabi-v7a

I tried to change defaultConfig in android/build.gradle

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "XXX"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode VERSION_CODE
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        manifestPlaceholders = [AppLabelName: "XXX"]
        multiDexEnabled true
        ndk  {
            abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        }
    }`

then run

flutter build apk --flavor production

still didn't work, When I tried to test it on

ASUS T00P • EAAZCY03U504 • android-arm • Android 4.4.2 (API 19)

it always show error

Performing Push Install
build\app\outputs\apk\production\release\app-production-release.apk: 1 file pushed. 3.5 MB/s (33320272 bytes in 9.085s)
        pkg: /data/local/tmp/app-production-release.apk
Failure [INSTALL_FAILED_MEDIA_UNAVAILABLE]

Upvotes: 2

Views: 2483

Answers (1)

MαπμQμαπkγVπ.0
MαπμQμαπkγVπ.0

Reputation: 6729

AFAIK, the official documentation stated that support building for x86 Android is not yet available:

When building your application in release mode, Flutter apps can be compiled for armeabi-v7a (ARM 32-bit), arm64-v8a (ARM 64-bit), and x86-64 (x86 64-bit). Flutter does not currently support building for x86 Android (See Issue 9253).

And here as well:

  • We support and test running Flutter on a variety of low-end to high-end platforms. For a detailed list of the platforms on which we test, see the list of supported platforms.

  • Flutter supports building ahead-of-time (AOT) compiled libraries for x86_64, armeabi-v7a, and arm64-v8a.

  • Apps built for ARMv7 or ARM64 run fine (using ARM emulation) on many x86 Android devices.

  • We support developing Flutter apps on a range of platforms. See the system requirements listed under each development operating system.

Regarding the support for building in x86 (32 bit), it was mentioned in this GitHub thread:

On master, Flutter now supports the x86_64 (64 bit) Android ABI. The engine also has support for building in x86 (32 bit) by following instructions at https://github.com/flutter/flutter/wiki/JIT-Release-Modes

Upvotes: 0

Related Questions