您已经尝试了针对此问题找到的所有其他答案:您的Android应用程序包使用了错误的密钥签名。确保您的应用程序包已签名[…]

您已经尝试了针对此问题找到的所有其他答案:您的Android应用程序包使用了错误的密钥签名。确保您的应用程序包已签名[…],android,react-native,android-studio,gradle,google-play,Android,React Native,Android Studio,Gradle,Google Play,我正在尝试将一个全新的应用程序上载到play store,但遇到错误“您的Android应用程序包使用错误的密钥进行了签名。请确保您的应用程序包使用正确的签名密钥进行了签名,然后重试”。我已尽最大努力遵守和理解说明,并相信我已经遵守了说明 从中,我完成了这些步骤并创建了一个新的keystore.jks文件。然后,我继续下一步,使用相同的密钥对我的应用程序进行签名,并提供用于创建应用程序的相同密码。我将他们的密钥别名保留为默认密钥0,并勾选了“导出加密密钥以在Google Play应用程序签名中注

我正在尝试将一个全新的应用程序上载到play store,但遇到错误“您的Android应用程序包使用错误的密钥进行了签名。请确保您的应用程序包使用正确的签名密钥进行了签名,然后重试”。我已尽最大努力遵守和理解说明,并相信我已经遵守了说明

从中,我完成了这些步骤并创建了一个新的keystore.jks文件。然后,我继续下一步,使用相同的密钥对我的应用程序进行签名,并提供用于创建应用程序的相同密码。我将他们的密钥别名保留为默认密钥0,并勾选了“导出加密密钥以在Google Play应用程序签名中注册已发布的应用程序”,尽管我还没有机会使用它导出的文件。我确保构建类型设置为release,而不是debug,并创建了app-release.aab文件

然后我继续下一节的“谷歌Play应用程序签名选择加入”/“”。步骤1包含在我之前采取的步骤中。然后,我登录开发者帐户并导航到我设置的应用程序(只有一个与该帐户关联),然后从右侧的导航转到应用程序发布页面

我向下滚动到“内部测试轨迹”并编辑版本。它被设置为编辑而不是创建,因为最初我尝试上载React Native 0.57应用程序,发现在商店接受它之前,我必须将其更新到更新的版本。我保留了名称和“此版本中有什么新功能?”部分,但删除了以前的应用程序并保存了页面。我还确保从工件库中删除这个以前的版本,该库现在是空的

当我尝试上载app-release.aab文件时,我被告知“您的Android应用程序包使用错误的密钥进行了签名。请确保您的应用程序包使用正确的签名密钥进行了签名,然后重试:SHA1:[…]”。这就是我现在被困的地方

我研究和尝试过的事情:

  • 我尝试过清理项目,重新创建密钥库文件,并用它重建应用程序。同样错误的键结果
  • 我已经更改了.jks文件的位置,以防在中发生缓存。同样错误的键结果
  • 我已经尝试从android/app/debug.keystore中删除debug.keystore文件,因为我不喜欢这样,没有它也无法成功构建捆绑包
  • 我已经检查了一些可能在.gradle文件中设置的可调试属性,debuggable=true和testCoverageEnabled=true(或其他值)。这两个都没有设定
  • 通过上述创建和签名步骤,我已确保在创建过程中使用相同的密码。同样错误的键结果
  • 哭泣和放弃。同样错误的键结果
  • 我已经了解到,在gradle文件中的任何位置指定signingConfig将覆盖您在创建捆绑包期间所做的选择,并且已经对release BuildType进行了注释。上传后,我被告知我的应用程序没有签名
  • 我没有使用AS,而是遵循以下指南:创建一个appname.keystore文件,为该文件签名configs{release{..}}条目,并按照指示通过gradlew bundrelease通过命令行创建.aab,然后上传该文件。同样错误的键结果
  • 我完全迷路了。我不知道下一步该怎么办。我所发现和尝试的一切都失败了,我再也找不到任何东西可以尝试了。请帮帮我

    下面是我的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: false,  // 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.[..]"
            minSdkVersion rootProject.ext.minSdkVersion
            targetSdkVersion rootProject.ext.targetSdkVersion
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
            missingDimensionStrategy 'react-native-camera', 'general'
        }
        splits {
            abi {
                reset()
                enable enableSeparateBuildPerCPUArchitecture
                universalApk false  // If true, also generate a universal APK
                include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
            }
        }
        signingConfigs {
            debug {
                storeFile file('debug.keystore')
                storePassword 'android'
                keyAlias 'androiddebugkey'
                keyPassword 'android'
            }
            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
                }
            }
        }
        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.release
                minifyEnabled enableProguardInReleaseBuilds
                proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            }
        }
        // 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 fileTree(dir: "libs", include: ["*.jar"])
        implementation "com.facebook.react:react-native:+"  // From node_modules
        implementation "com.google.android.gms:play-services-gcm:12.+"
    
        implementation 'androidx.appcompat:appcompat:1.0.0'
        implementation 'com.android.support:appcompat-v7:XX.X.+'
    
        implementation 'com.android.support:multidex:1.0.3'
    
        androidTestImplementation 'androidx.annotation:annotation:1.0.0'
    
        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)
    
    android\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
            googlePlayServicesVersion = "16.+"
            firebaseVersion = "17.3.4"
        }
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath('com.android.tools.build:gradle:3.5.2')
            classpath 'com.google.gms:google-services:3.0.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    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' }
        }
    }
    
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.+"
            }
            if (details.requested.group == 'com.google.android.gms'
            && !details.requested.name.contains('multidex') && (
                !details.requested.name.contains('play-services-stats') ||
                !details.requested.name.contains('play-services-vision-image-label') ||
                !details.requested.name.contains('play-services-clearcut') ||
                !details.requested.name.contains('play-services-flags') ||
                !details.requested.name.contains('play-services-phenotype')
                )) {
                details.useVersion "12.+"
            }
            if (details.requested.group == 'com.google.android.gms'
            && !details.requested.name.contains('multidex') && (
                details.requested.name.contains('play-services-stats') ||
                details.requested.name.contains('play-services-vision-image-label') ||
                details.requested.name.contains('play-services-clearcut') ||
                details.requested.name.contains('play-services-flags') ||
                details.requested.name.contains('play-services-phenotype')
                )) {
                details.useVersion "+"
            }
            if (details.requested.group == 'com.google.firebase'
            && !details.requested.name.contains('multidex') && details.requested.name.contains('firebase-messaging')) {
                details.useVersion "12.+"
            }
        }
    }
    
    ext {
        googlePlayServicesVersion = "+" // default: "+"
        firebaseVersion = "+" // default: "+"
        // Other settings
        compileSdkVersion = 28 // default: 23
        buildToolsVersion = "28.0.3" // default: "23.0.1"
        targetSdkVersion = 28 // default: 23
        supportLibVersion = "28.0.0"
    }
    
    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
    
    org.gradle.jvmargs=-Xmx4608m
    android.useAndroidX=true
    android.enableJetifier=true
    
    MYAPP_UPLOAD_STORE_FILE=[...].keystore
    MYAPP_UPLOAD_KEY_ALIAS=[...]
    MYAPP_UPLOAD_STORE_PASSWORD=[...]
    MYAPP_UPLOAD_KEY_PASSWORD=[...]
    

    因此,听起来好像您已经创建并签署了应用程序的React本机版本,具有相同的捆绑包标识符,并尝试和/或成功地将二进制文件上传到您的Google Play控制台。现在,您正在尝试上载另一个二进制文件,该文件使用不同的密钥签名,但具有相同的包标识符。对吗

    如果是这样,您将不得不将应用程序名称和捆绑标识更改为全新的内容(除非您已经找到一种方法,从控制台中完全删除以前对项目的所有引用,并使用“添加”而不是“编辑”,我认为这是不可能的)


    此外,您应该检查您将什么日期用作“Release”密钥库的到期日期。通常,他们会给你一个建议你使用的最长日期,大约是100年后,但你必须用谷歌搜索他们建议的确切日期。如果您的发布密钥库太早过期,您将无法在过期后生成发布版本。

    我认为过期日期是默认日期,即25年iirc?是的,我试图上传0.57版本,但被拒绝了,我升级到了0.61,现在商店不接受。所以我需要把它从com.appname改成com.appname2或者别的什么?是这样吗?我只把以前的0.57应用程序上传到内部测试轨道,但被拒绝了。我没有意识到永久销毁一个有效的bundle标识符这么容易,我应该使用com.thisisnotthefinalbundlename直到最后,并在发布之前将其切换掉吗?我打算尝试删除所有引用,因为它只是应用程序名称和内部跟踪中的发行说明,但谷歌Play控制台现在似乎无法访问,当我尝试访问它时,给了我一个“发生意外错误。请稍后再试。(1000004)”。一旦我有能力,我将尝试从控制台删除我能删除的所有内容,并添加而不是编辑。好的,你可以放弃我为内部曲目发布的应用程序版本。据我所知,我在任何地方都没有提到任何APK或类似的东西。工件库中没有,草稿中没有APK,什么都没有。我在内部测试下创建了一个新版本,选择了我的app-release.aab文件,收到了相同的错误