android - 无法在 Google Play 商店中上传 64 位版本

标签 android android-studio build.gradle 32bit-64bit google-play-console

根据最近的 Google 政策变化,我们正在尝试上传 64 位和 32 位版本。

我们在 Build.gradle 中包含了相应的abifilter“ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'”。

我们能够生成构建版本,但是当我们将构建版本上传到 Play 控制台进行 Beta 审核时。它会发出警告“版本不符合 64 位 Google 要求”。 enter image description here

我们尝试了所有方法,生成 4 个版本(x86,x86_64,armeabi-v7a,arm64-v8a),生成两个版本或使用所有 abifilter 上传通用版本,它给出了相同的警告。我们尝试了所有可能的方法。

请帮助我们完成将构建版本上传到 Play 商店的完美步骤,或者如果我们在生成构建版本时出现任何错误,也请告知我们。

请检查build.gradle代码:

     {
         minSdkVersion 19
         applicationId 'com.xxx.xxx'
         targetSdkVersion 28
         testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
         versionCode 32 // 27-30
         versionName '1.2.1'
         ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
         proguardFile 'proguard-android.txt'
      }

此外,我们尝试了下面给出的另一种方法:

  splits {
    // Configures multiple APKs based on ABI.
    abi {
        // Enables building multiple APKs per ABI.
        enable true
        // By default all ABIs are included, so use reset() and include to specify that we only
        // want APKs for x86 and x86_64.
        // Resets the list of ABIs that Gradle should create APKs for to none.
        reset()
        // Specifies a list of ABIs that Gradle should create APKs for.
        include "x86", "x86_64", "arm64-v8a", "armeabi-v7a"

        // Specifies that we do not want to also generate a universal APK that includes all ABIs.
        universalApk true
    }
}



ext.abiCodes = ["x86": 1, "x86_64": 2, "armeabi-v7a": 3, "arm64-v8a": 4]

import com.android.build.OutputFile

// For each APK output variant, override versionCode with a combination of
// ext.abiCodes * 1000 + variant.versionCode. In this example, variant.versionCode
// is equal to defaultConfig.versionCode. If you configure product flavors that
// define their own versionCode, variant.versionCode uses that value instead.
android.applicationVariants.all { variant ->

// Assigns a different version code for each output APK
// other than the universal APK.
variant.outputs.each { output ->

    // Stores the value of ext.abiCodes that is associated with the ABI for this variant.
    def baseAbiVersionCode =
            // Determines the ABI for this variant and returns the mapped value.
            project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))

    // Because abiCodes.get() returns null for ABIs that are not mapped by ext.abiCodes,
    // the following code does not override the version code for universal APKs.
    // However, because we want universal APKs to have the lowest version code,
    // this outcome is desirable.
    if (baseAbiVersionCode != null) {

        // Assigns the new version code to versionCodeOverride, which changes the version code
        // for only the output APK, not for the variant itself. Skipping this step simply
        // causes Gradle to use the value of variant.versionCode for the APK.
        output.versionCodeOverride =
                baseAbiVersionCode * 1 + variant.versionCode
    }
}
}

最佳答案

经过几天的努力,在这里找到了可行的解决方案:diego.org

基本上,如果您需要 64 位库,您首先需要从源站点(相应的库站点)下载正确的库。检查您使用的库版本是否有64位库可用。

然后将其安装到本地 Maven 存储库(基本上,您的本地 Maven 将用于生成 64 位 apk):

mvn install:install-file -DgroupId= (library group for e.g.org.xwalk) -DartifactId= (library name for e.g.xwalk_core_library) \
-Dversion=(version no for e.g.23.53.589.4-64bit) -Dpackaging=aar  \
-Dfile=(file name for e.g.xwalk_core_library-23.53.589.4-64bit.aar) \
-DgeneratePom=true

并更新您的构建 gradle,以便存储库指向您本地的 Maven 存储库:

repositories {
   mavenLocal()
}

并且您编译了正确的库:

compile 'org.xwalk:xwalk_core_library:23.53.589.4' // Use this library for generating "armeabi-v7a" & "x86" build
compile 'org.xwalk:xwalk_core_library:23.53.589.4-64bit' // Use this library for generating "arm64-v8a" & "x86_64" build

使用gradle配置:

ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' // For your flavor or defaultConfig 

按照这些步骤将生成两个版本,一个使用 32 位,另一个使用 64 位,这样做还可以帮助您避免诸如“Fully Shadowed apk

希望这有帮助。

关于android - 无法在 Google Play 商店中上传 64 位版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56592248/

相关文章:

android - 插入外部电话时,Android Studio libGDX不显示错误消息

android - React Native - 如何让 productFlavors 具有不同的 applicationIds?

java - 错误 : Program type already present: com. rom4ek.arcnavigationview.R

android adb 经常与 eclipse 断开连接?

Android Listview 测量高度

android - 如何在 RecyclerView 中使用 LoadMore?

android - 检查所有 API 警告/错误

android - ThisTime 和 TotalTime 有什么区别?为什么有时两个值相等,有时不同?

java - 如何在相机 2 api 片段中捕获和预览显示到 ImageView ?

react native 0.55.2上的Android构建错误