[英]You uploaded an APK that was signed in debug mode. You need to sign your APK in release mode error
I am trying to upload an Application on the Google Play store.我正在尝试在 Google Play 商店上传应用程序。 I am building the .apk and signing it using Maven.
我正在构建 .apk 并使用 Maven 对其进行签名。 I have used maven-jarsigner-plugin to sign the .apk file.
我已经使用 maven-jarsigner-plugin 来签署 .apk 文件。 I am using the key that I created using Eclipse wizard for signing another Android app.
我正在使用我使用 Eclipse 向导创建的密钥来签署另一个 Android 应用程序。 I zipalign the .apk file using the following command: zipalign [-f] [-v] infile.apk outfile.apk
我使用以下命令压缩 .apk 文件:zipalign [-f] [-v] infile.apk outfile.apk
When I try to uplaod the application on the playstore, I get the error You uploaded an APK that was signed in debug mode.当我尝试在 Playstore 上上传应用程序时,出现错误您上传了在调试模式下签名的 APK。 You need to sign your APK in release mode.
您需要在发布模式下签署您的 APK。 Can anyone please tell me how to sign the apk in release mode?
谁能告诉我如何在发布模式下签署apk? I am new to Maven (started using it today).
我是 Maven 的新手(今天开始使用它)。 Thanks
谢谢
Change to: signingConfig signingConfigs.release更改为:signingConfigsigningConfigs.release
from signingConfig signingConfigs.debug从signingConfigsigningConfigs.debug
in your build.gradle app level在您的 build.gradle 应用程序级别
I don't know how you do that in Maven, but you need to compile your app with a release keystore.我不知道您如何在 Maven 中执行此操作,但是您需要使用发布密钥库编译您的应用程序。 You can create one with
keytool
, which is available in your Java bin folder:您可以使用
keytool
创建一个,它位于您的 Java bin 文件夹中:
$ keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000
When creating it, you must supply two passwords, one for the keystore and one for the key.创建它时,您必须提供两个密码,一个用于密钥库,一个用于密钥。 When your keystore is created, you can use the Eclipse Export wizard to compile your app in release mode.
创建密钥库后,您可以使用 Eclipse 导出向导在发布模式下编译您的应用程序。
For further details, please refer to http://developer.android.com/tools/publishing/app-signing.html#releasemode有关更多详细信息,请参阅http://developer.android.com/tools/publishing/app-signing.html#releasemode
Always create your keystore with name and alias containing "release" not "debug".始终使用包含“发布”而不是“调试”的名称和别名创建您的密钥库。 If you are having the "You uploaded an APK that was signed in debug mode. You need to sign your APK in release mode error" it's certain that you are using default keystore which is 'debug.keystore' hence generating apk in debug mode.
如果您遇到“您上传了在调试模式下签名的 APK。您需要在发布模式下签名您的 APK 错误”,则可以肯定您使用的是默认密钥库,即“debug.keystore”,因此在调试模式下生成了 apk。
Solution解决方案
this should fix the issue.这应该可以解决问题。
Go to android/app/build.gradle转到android/app/build.gradle
At the end of the file:在文件末尾:
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug <==== change this to release
}
}
Resul should be like:结果应该是这样的:
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
I had the same issue with my flutter app,我的颤振应用程序遇到了同样的问题,
Add these to your android/app/build.将这些添加到您的 android/app/build.gradle 文件中。 Gradle:
摇篮:
before android { compileSdkVersion 30在 android { compileSdkVersion 30 之前
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
And after defaultConfig {然后在 defaultConfig {
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
For flutter error, By default flutter creates buildtypes like below对于颤振错误,默认情况下颤振会创建如下所示的构建类型
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
you should change the signingconfig line你应该改变signingconfig行
signingConfig signingConfigs.release
Using -genkeypair instead of -genkey solved the problem for me.使用 -genkeypair 而不是 -genkey 为我解决了这个问题。
So: keytool -genkeypair -keystore name.keystore -alias nameapp -keyalg RSA所以:keytool -genkeypair -keystore name.keystore -alias nameapp -keyalg RSA
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.