How to build app compliant with Google Play 64-bit requirement?

After I upload the APK to play store I got the following warning. What changes should I make to release an APK build with flutter SDK to meet the 64-bit requirement?

The warning message:
enter image description here

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Edit/Update: Google has released Flutter 1.7.8+hotfix.3 in stable channel, which makes easy to build an app for release.

Now you have two options to build :

  1. App bundle (preferred)
  2. APK

Generating App Bundle

Run flutter build appbundle

This will create <app dir>/build/app/outputs/bundle/release/app.aab

T app bundle contains your Dart code and the Flutter runtime compiled for armeabi-v7a (32-bit) and arm64-v8a (64-bit).

Now you can upload this app bundle to google play.

Build an APK

flutter build apk --split-per-abi

This command results in two 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

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.

If you haven’t upgraded to flutter 1.7 Below solution should still
work.

You need to build two apk and upload them together. one for 32 and another for 64 bit.

This is what worked for me I am on flutter v1.5.4-hotfix.2

First, run flutter build apk --release and upload the apk file

Then increase the version and build number in pubspec.yml file and run

flutter build apk --release --target-platform=android-arm64

Upload this new apk and start rollout.

Good luck

Solution 2

Guys they changed new policies for 64-bit architectures. So please put this code in your gradle

ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'

for e.g.

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.test.test"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
}

Solution 3

What worked for me was

flutter build appbundle --release 

Upload the appbundle file

Then increase the version and build number in the pubspec.yml file and run

flutter build appbundle --release --target-platform=android-arm64

Upload also this new appbundle.

Then the play store accepted my release

Solution 4

I finally was able to fix this by adding this to build.gradle

 ndk {
        abiFilters  "armeabi-v7a", "arm64-v8a"
    }
}

splits {
    abi {
        include  "armeabi-v7a", "arm64-v8a"
    }
 }
 applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "arm64-v8a":2]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
 }

There is not a lot of clear documentation on this, I happened to run into this by scouring the internet.

Solution 5

Now there is a new better solution provided by the futter team.
You need to use the new flutter version 1.7.12. (my setup)

Flutter 1.7.12-pre.40 • channel master • https://github.com/flutter/flutter.git
Framework • revision 3badcf51a4 (13 hours ago) • 2019-06-28 15:14:03 -0700
Engine • revision e96900df2f
Tools • Dart 2.4.0

Then you can build your (single) app bundle for x86 and x64 with this command.
flutter build appbundle

Additional you can add --release --target-platform android-arm,android-arm64. But this might cause a broken app…

Solution 6

Use latest master channel of Flutter.
flutter build apk will result into a fat APK containing support for both 32-bit and 64-bit.

To create 32-bit and 64-bit APK separately, use flutter build apk --split-per-abi command

Solution 7

Flutter 1.5.4-hotfix.2 appbundle currently targets android-arm which builds only 32bit native code (flutter build appbundle -h). To change this run flutter build appbundle --target-platform=android-arm64 to change the default target.

Solution 8

I built mine with this code and i still get the error.

flutter build appbundle –target-platform=android-arm64

Solution 9

if you use Android Studio

just go to Build -> Flutter -> Build App Bundle to replace it with apk when uploaded to google play

Solution 10

Add this line to your android/app/build.gradle file

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

Solution 11

I try all answers and Its stay shows the same issue.

I tried to add this line as the most answers:

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

but it’s not solved.

what’s solved my problem?

just you need to add "armeabi" to the last code and it will be like:

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

this solution saved my day and I uploaded my app bundle successfully!

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply