首页 > 解决方案 > Android 无法将应用程序添加到谷歌商店 APK 或 App Bundle 可用于 64 位设备,但它们只有 32 位本机代码

问题描述

当我尝试将应用程序放入谷歌商店时,我看到了这个:

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

以下 APK 或 App Bundle 可用于 64 位设备,但它们只有 32 位本机代码。我只有 32 位本机代码,我在 build gradle 上执行此操作:

从 2019 年 8 月 1 日起,所有版本都必须符合 Google Play 64 位要求。

在您的应用程序中包含 64 位和 32 位本机代码。使用 Android App Bundle 发布格式自动确保每个设备架构只接收它需要的本机代码。这样可以避免增加应用程序的整体大小。

ndk {
            moduleName "***"
                abiFilters "armeabi", "armeabi-v7a", "x86_64", "mips",'arm64-v8a'
        }



        task nativeLibsToJar(type: Jar, description: 'create a jar archive of the native libs') {
            destinationDir file("$buildDir/native-libs")
            baseName 'native-libs'
            from fileTree(dir: 'libs', include: '**/*.so')
            into 'lib/'
        }

        tasks.withType(JavaCompile) {
            compileTask -> compileTask.dependsOn(nativeLibsToJar)
        }
        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
                }
            }
        }

但我无法在谷歌商店添加 apk

在此处输入图像描述

编辑

在此处输入图像描述

编辑

[![在此处输入图像描述][3]][3]

编辑 [![在此处输入图像描述][4]][4]

标签: androidandroid-ndkandroid-build

解决方案


支持 64 位架构的所有内容都在这里

https://inneka.com/programming/android/how-to-include-so-library-in-android-studio-2/

检查您的项目结构并包含如下库..

 project/
├──libs/
|  └── *.jar       <-- if your library has jar files, they go here
├──src/
   └── main/
       ├── AndroidManifest.xml
       ├── java/
       └── jniLibs/ 
           ├── arm64-v8a/                       <-- ARM 64bit
           │   └── yourlib.so
           ├── armeabi-v7a/                     <-- ARM 32bit
           │   └── yourlib.so
           └── x86/                             <-- Intel 32bit
               └── yourlib.so

推荐阅读