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

前端 未结 10 1418
情话喂你
情话喂你 2020-12-01 10:46

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?

相关标签:
10条回答
  • 2020-12-01 10:50

    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.

    0 讨论(0)
  • 2020-12-01 10:56

    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.

    0 讨论(0)
  • 2020-12-01 11:01

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

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

    0 讨论(0)
  • 2020-12-01 11:08

    if you use Android Studio

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

    0 讨论(0)
  • 2020-12-01 11:10

    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"
        }
    }
    
    0 讨论(0)
  • 2020-12-01 11:12

    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...

    0 讨论(0)
提交回复
热议问题