简体   繁体   English

React Native 0.61 版本中的 Google Play 64 位要求

[英]Google Play 64-bit requirement in React Native Version 0.61 release

I used to use version 0.54 of React Native, but due to a problem with the 64-bit version of Google, I had to create a new project (I did not update this version, but I created a new version).我以前用的是0.54版本的React Native,但是由于64位版本的谷歌有问题,不得不新建一个项目(这个版本我没有更新,但是我新建了一个版本)。

I am currently using version 0.61.4 of React Native我目前正在使用 React Native 的0.61.4版本

After I got the aab output and wanted to publish it on Google Play, unfortunately I still had the same problem as before and I get the following error在我得到aab output 并想在 Google Play 上发布它之后,不幸的是我仍然遇到和以前一样的问题,我收到以下错误

This release is not compliant with the Google Play 64-bit requirement此版本不符合 Google Play 64 位要求

The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 9.以下 APK 或 App Bundle 可用于 64 位设备,但它们只有 32 位本机代码:9。

Include 64-bit and 32-bit native code in your app.在您的应用程序中包含 64 位和 32 位本机代码。 Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code it needs.使用 Android App Bundle 发布格式自动确保每个设备架构只接收它需要的本机代码。 This avoids increasing the overall size of your app这样可以避免增加应用程序的整体大小

在此处输入图像描述

I put the gradle codes here for guidance我把gradle代码放在这里作为指导

android/app/build.gradle android/app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.....android"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 34
        versionName "3.0"
        multiDexEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            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
            }

        }
    }
}

dependencies {
    implementation 'com.facebook.fresco:fresco:2.0.0'
    implementation 'com.facebook.fresco:animated-gif:2.0.0'
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

    //https://github.com/kmagiera/react-native-screens
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'


    //https://github.com/react-native-community/react-native-maps/blob/master/docs/installation.md
    implementation(project(':react-native-maps')){
       exclude group: 'com.google.android.gms', module: 'play-services-base'
       exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation 'com.google.android.gms:play-services-base:+'
    implementation 'com.google.android.gms:play-services-maps:+'

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)


// FIREBASE SDKs => https://invertase.io/oss/react-native-firebase/quick-start/android-firebase-credentials
apply plugin: 'com.google.gms.google-services'

android/gradle.properties安卓/gradle.properties

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

android.useAndroidX=true
android.enableJetifier=true


MYAPP_UPLOAD_STORE_FILE=key.jks
MYAPP_UPLOAD_KEY_ALIAS=MY_KEY_ALIAS
MYAPP_UPLOAD_STORE_PASSWORD=******
MYAPP_UPLOAD_KEY_PASSWORD=*****

android/build.gradle安卓/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:3.5.1')

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        // FIREBASE SDKs => https://invertase.io/oss/react-native-firebase/quick-start/android-firebase-credentials
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

在此处输入图像描述

Update更新

I run the following in a terminal for get AAB file:我在终端中运行以下命令来获取AAB文件:

$ cd android
$ gradlew cleanBuildCache
$ gradlew clean
$ gradlew bundleRelease

After running the above commands, I will receive the following output:运行以上命令后,会收到如下output:

在此处输入图像描述

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 6.0 不兼容。 Use '--warning-mode all' to show the individual deprecation warnings.使用“--warning-mode all”显示各个弃用警告。 See http....见 http....

BUILD SUCCESSFUL in 5m 21s 336 actionable tasks: 336 executed在 5m 21s 内构建成功 336 个可操作的任务:336 个已执行

After Upload in Google Console在 Google 控制台中上传后

This is very strange这很奇怪

在此处输入图像描述

There is nothing wrong with the App Bundle ABB file generated.生成的 App Bundle ABB 文件没有任何问题。 The problem is that there is an older active release that does not include 64 bit binaries and you have to deactive it in order for Google Play to process the new release.问题是有一个较旧的活动版本不包含 64 位二进制文件,您必须停用它才能让 Google Play 处理新版本。

Please check "Step 2: Prepare your app's release > Android App Bundles and APKs to deactivate" in the "Prepare & roll out releases" documentation on how to deactivate a previous APK/Bundle release.请查看“ 准备和发布版本”文档中的“第 2 步:准备您的应用程序版本 > Android 应用程序包和要停用的 APK” ,了解如何停用以前的 APK/Bundle 版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 此版本符合 Google Play 64 位原生应用的要求 - This release is compliant with the Google Play 64-bit requirement native app Google play : 此版本不符合 Google play 64 位要求 - Google play : This release is not compliant with the Google play 64-bit requirement 此版本不符合Google Play 64位要求。 本机Java应用程序已经存在所有.so - This release is not compliant with the Google Play 64-bit requirement. All .so already exists for native java app 此版本不符合 Google Play 64 位要求错误 - This release is not compliant with the Google Play 64-bit requirement error Google Play 64 位要求 - Google Play 64-bit requirement Google Play 64位要求问题 - Google Play 64-bit requirement issue Play 商店 - 此版本不符合 Google Play 64 位要求(ABI 拆分 x86 构建) - Play Store - This release is not compliant with the Google Play 64-bit requirement (ABI Split x86 build) 发现错误“此版本不符合 Google Play 64 位要求(Opencv lib)” - Error found "This release is not compliant with the Google Play 64-bit requirement(Opencv lib)" 添加库后,此版本仍不符合 Google Play 64 位要求错误 - This release is not compliant with the Google Play 64-bit requirement error still after adding libraries Delphi 10.1 - Google Play 控制台 - 审核和发布错误“此版本不符合 Google Play 64 位要求。” - Delphi 10.1 - Google Play Console - Review and Release Error "This release is not compliant with the Google Play 64-bit requirement."
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM