【发布时间】:2019-10-28 17:47:53
【问题描述】:
根据最近的 Google 政策变更,我们正在尝试上传 64 位和 32 位版本。
我们在 Build.gradle 中包含了各自的 abifilter "ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'"。
我们能够生成构建,但是当我们将构建上传到 Play 控制台进行 Beta 审核时。它会发出警告说“Release is not compatible with 64-bit Google Requirement”。
我们尝试了所有方法,生成 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
}
}
}
【问题讨论】:
-
我投票结束这个问题,因为meta.stackoverflow.com/q/272165/6296561
标签: android android-studio build.gradle 32bit-64bit google-play-console