此版本不符合Google Play 64位要求React Native Android

时间:2019-11-11 11:06:57

标签: react-native google-play react-native-android

我已经将我的React本机版本0.57.1​​升级到0.59.1,并解决了所有库问题。成功构建后,我上传了.aap文件以播放商店,但出现以下错误:

错误 此版本不符合Google Play 64位要求 以下APK或应用捆绑包可用于64位设备,但它们只有32位本机代码:21。 在您的应用程序中包括64位和32位本机代码。使用Android App Bundle发布格式自动确保每种设备架构仅接收所需的本机代码。这样可以避免增加应用程序的整体大小。

请让我知道是否有人可以解决此问题,谢谢!

这是我的build.gradle

buildscript {
    ext {
      buildToolsVersion = "28.0.3"
      minSdkVersion = 19
      compileSdkVersion = 28
      targetSdkVersion = 28
      supportLibVersion = "1.0.0-beta01"
      googlePlayServicesAuthVersion = "17.0.0"
    }

package.json

"react": "16.8.3",
"react-native": "^0.59.1",

1 个答案:

答案 0 :(得分:2)

添加abi过滤器(“ arm64-v8a”和“ x86-64”)

android {
    ...   

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    // In case, if you're using `ndk`
    defaultConfig {
        ndk {
            // Tells Gradle to build outputs for the following ABIs and package
            // them into your APK.
            abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) { 
                output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}
    ...