【问题标题】:Not able to Upload 64-bit build in Google play Store无法在 Google Play 商店中上传 64 位版本
【发布时间】: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
    }
}
}

【问题讨论】:

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


【解决方案1】:

经过几天的奋斗,在这里找到了可行的解决方案: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 

按照这些步骤将生成两个版本,一个是 32bit,另一个是 64bit,这样做还可以帮助您避免类似“Fully Shadowed apk"

希望这会有所帮助。

【讨论】:

    【解决方案2】:

    使用Android App Bundle Publishing 方法来避免这些错误。 谷歌将为所有类型的设备构建您的应用程序。

    【讨论】:

    • 感谢您的回复,但由于App有些复杂,我们将无法使用Android App Bundle方式。
    【解决方案3】:

    首先你设置 Universal APK = False

    关注这个 Gradle

    android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "photo.abc.video"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 2
        versionName "2.0"
        multiDexEnabled true
        ndk {
            moduleName "andengine_shared"
        }
    }
    useLibrary 'org.apache.http.legacy'
    sourceSets {
        main {
            jni.srcDirs = []
        }
    }
    
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    
    splits {
        abi {
            enable true
            reset()
            include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
            universalApk false
        }
     }
    }
    
    ext.abiCodes = ['x86':1, 'x86_64':2, 'armeabi-v7a':3, 'arm64-v8a':4]
    

    【讨论】:

    • 感谢您的回复,但即使我说universalApk = false,如果我使用这个64位版本中的任何一个,我仍然会生成4个版本,它会显示相同的警告。
    • 先比较我和你的gradle,然后告诉我后再做一些改变
    • 完全一样,只是universalApk标志不同。
    • 你没有 lint 选项并从默认配置中删除 ndk.abifilter
    • 如果是,您在应用程序中使用任何本机代码,因此必须使用 ndk.AbiFilter 否则不需要 ndkfilter 得到它。
    【解决方案4】:

    我解决了我的问题很容易你不需要 mvn install:install-file

    去下载页面

    https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/21.51.546.7/
    

    并下载2个库

    1-32位

    2-64 位

    这个
    xwalk_core_library-21.51.546.7-arm64.aar
    和这个 xwalk_core_library-21.51.546.7-x86.aar

    下载后需要用winrar打开文件

    取出 x86 libart 并添加到 arm64 文件中

    所以现在我们在 32 位和 64 位文件上有 2 个库

    现在将此库添加到 android stiduo

    文件 - 新建 - 新模块 - jar/aar

    添加你的库

    之后

    在你的项目中添加你的库

    在你的构建 gradle 中

     defaultConfig {
            minSdkVersion 16
            targetSdkVersion 28
            versionCode 17
            versionName "3.2"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled = true
            ndk {
                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86' ,'x86_64'
            }
    

    都是这样

    apk 分析是的,您现在有 2 个 32 位和 64 位库,您可以更新您的应用程序

    【讨论】:

    • 这可能是目前执行此操作的最干净的方法,尤其是因为不支持此操作,除非您想要进行多个 APK 构建。有趣的是,我在使用相同 xwalk 库的遗留项目中也遇到了这个问题,所以这个答案拯救了我的一天!
    猜你喜欢
    • 1970-01-01
    • 2019-12-26
    • 2023-02-17
    • 1970-01-01
    • 2014-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多