我正在尝试上传一个全新的应用程序到play store,但遇到错误“您的Android应用程序包是用错误的密钥签名的。请确保您的应用程序包是用正确的签名密钥签名的,然后再试一次”。我已经尽我最大的努力去遵循和理解这些指示,并且相信我已经遵循了这些指示。
在https://developer.android.com/studio/publish/app-signing#generate-key中,我已经完成了这些步骤,并创建了一个新的keystore.jks文件。然后,我继续下一步,并使用相同的密钥签署我的应用程序,提供相同的密码用于创建它。我把他们的密钥别名留为key0,这是默认的,并且勾选了“在Google Play应用签名中为注册发布的应用导出加密密钥”,尽管我没有机会使用它导出的文件。我确保构建类型设置为release,而不是debug,并创建了app-release.aab文件。
然后,我继续下一节的‘选择在应用签署由Google Play’/‘选择在一个新的应用’。步骤1包含了我前面所采取的步骤。然后我登录到developer帐户并导航到我设置的应用程序(只有一个与该帐户相关联),然后从右侧的导航转到应用程序发布页面。
我向下滚动到“内部测试轨道”并编辑发布。它被设置为edit,而不是create,因为最初我试图上传一个React Native 0.57应用程序,发现我必须更新它到一个更新的版本,商店才会接受它。我保留了名字和‘这个版本有什么新内容?’节,但删除了之前存在的应用程序并保存了该页面。我还确保从工件库中删除这个以前的版本,现在工件库是空的。
当我尝试上传app-release.aab文件时,我被告知“您的Android应用包使用错误的密钥签名。请确保您的应用包使用正确的签名密钥签名,然后重试:sha1:[...]”。这就是我现在被困的地方。
我研究和尝试过的事情:
我绝对,完全迷失了。我不知道下一步该做什么。我所发现和尝试的一切都失败了,我再也找不到可以尝试的东西了。请帮帮我.
以下是我的分级文件:
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原生版本,使用相同的bundle标识符,并尝试和/或成功地将二进制文件上传到了Google Play控制台。现在,您正在尝试上传另一个二进制文件,它使用不同的密钥签名,但使用相同的包标识符。那是正确的吗?
如果是这样的话,你将不得不把应用程序名称和包标识符更改为全新的(除非你已经找到了一种方法,可以从控制台中完全删除所有以前对你的项目的引用,并且用“add”代替“edit”,我认为这是不可能的)。
此外,您应该检查您使用了什么日期作为您的“发布”密钥库的过期日期。通常,他们有一个最大的日期,他们建议你使用,大约是100年的未来,但你必须谷歌他们建议的确切日期。如果您的发行版密钥存储库过期得太快,那么在它过期之后您将无法构建发行版构建。
我如何用正确的签名密钥为我的android应用包签名?
我只是不太明白为什么这会发生在我身上,我按照https://flutter.dev/docs/deployment/android中的所有步骤上传了我的第一个版本,其中有一些错误,所以我创建了另一个(以前的备份项目)flutter项目并将其修改为现有的项目,我更改了com.flutterappstareawayvrsn1,它最初是其他的。 我已经把钥匙放好了,它仍然显示错误: 您的Android应
我刚刚开始使用应用程序包。我已经在仪表板的部分设置了两个证书(签名证书和上载证书)。 我已经构建了一个应用程序包,并用上传证书签名,但是当我在下上传包时(这实际上是我切换到应用程序包的原因),它说:
将我的第二个应用程序项目上载到PlayStore时,我在上载时遇到以下错误。新版本的aab文件: “您的Android应用程序包使用了错误的密钥进行了签名。请确保您的应用程序包使用了正确的签名密钥进行了签名,然后重试。您的应用程序包应该使用指纹证书进行签名:::” 我所做的是使用我的第一个应用程序的密钥/我的旧密钥库文件,并在Android studio“build”中使用这个密钥库文件- 在游戏
我有一个现有的密钥存储,有一个密码和几个不同密码的钥匙在不同的应用程序,我已经导出和上传到谷歌播放。 现在我最近导入了一个应用程序的项目,对它做了一些重要的修改,我试图使用相同的密钥存储和选择相同的别名/密码导出它,就像我最初创建它一样。 问题是,在我选择密钥别名并输入密钥密码的步骤之后,我看到“错误:无法恢复密钥”。
我有一个非常简短的问题。我正准备在Play Store上传我的应用程序。上传时我的AppBundle有一些错误,所以我用一个新的密钥重新做了所有的事情。在此之后,播放控制台出现了标题中的错误。 现在我的问题是:由于我的应用程序还没有发布,这是不是最好的方法,只是从我的仪表板上删除应用程序,然后用我的新钥匙做一个新的?还是我需要为新的应用程序使用相同的密钥?? 谢谢你的回答。