问题
I am trying to upload an Application on the Google Play store. I am building the .apk and signing it using Maven. I have used maven-jarsigner-plugin to sign the .apk file. I am using the key that I created using Eclipse wizard for signing another Android app. I zipalign the .apk file using the following command: 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. You need to sign your APK in release mode. Can anyone please tell me how to sign the apk in release mode? I am new to Maven (started using it today). Thanks
回答1:
I don't know how you do that in Maven, but you need to compile your app with a release keystore. You can create one with keytool
, which is available in your Java bin folder:
$ 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.
For further details, please refer to http://developer.android.com/tools/publishing/app-signing.html#releasemode
回答2:
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.
Solution
- Generate new keystore
- Give reference in build.gradle file
- Change build variant to 'release'
- Build
this should fix the issue.
回答3:
Using -genkeypair instead of -genkey solved the problem for me.
So: keytool -genkeypair -keystore name.keystore -alias nameapp -keyalg RSA
来源:https://stackoverflow.com/questions/16681282/you-uploaded-an-apk-that-was-signed-in-debug-mode-you-need-to-sign-your-apk-in