Android release keystore issue: “Keystore was tampered with, or password was incorrect”

最后都变了- 提交于 2019-12-09 00:06:36

问题


A couple of months ago I generated my android release keystore with this command:

keytool -genkey -v -keystore my-release-key.keystore -alias myalias -keyalg RSA -keysize 2048 -validity 10000

I entered a password for the keystore and wrote it down, in the last step, when it was time to enter a password for the certificate I pressed enter to use the same password as the keystore (so I had to remember only one password for the whole process).

After generating this keystore I signed my apk for release using this command:

jarsigner -verbose -keystore my-release-key.keystore my.apk myalias

where I entered my password (no problem).

Now I have to push an update to my apk in the market and when I try to sign the new apk using the command above I get a "Keystore was tampered with, or password was incorrect".

I'm puzzled, I went back to my keystore backup and I get the same problem. I'm sure the password is correct. Note that I'm not using Eclipse at all for the process (I'm signing from the command line).

What could be the problem here? Heeelppp!!


回答1:


Sharing my experience with the community...

JDK 1.7 build.gradle for android

android {
    compileSdkVersion 18
    buildToolsVersion "17.0.0"

    signingConfigs {
        release {
            storeFile file("../my-release.keystore")
            storePassword "$MakeMyDay!"
            keyAlias "my-release"
            keyPassword "$MakeMyDay!"
        }
    }
:

When I gradlew assembleRelease, I got the dreaded "tampered with or password was incorrect" error.

Resolution:

Use a simpler password, like abcdef. Not sure if special characters like $ and ! were supported.




回答2:


This error occurred with me because I had a comma in my Company name, for instance "Company, Inc." Removed the comma and everything worked ok. Hope that helps.




回答3:


The implicit keyalg, digestalg and/or sigalg has changed between different versions of Java and possibly eclipse.

Use the command line and try a couple different combinations. This worked for me after creating the key with Java 5.0 but upgrading my system to Java 6 jarsigner -verbose -keystore <.keystore> -sigalg MD5withRSA -digestalg SHA1 <apk file> <alias>




回答4:


That message means the password is wrong. It looks like you have not remembered the password you used for the key store.

It's strongly advised when creating a key and password to keep copies somewhere very safe, protected from forgetting, fire, drive failure etc because the consequences can be very severe (not being able to ever update the app in the Market).



来源:https://stackoverflow.com/questions/9309975/android-release-keystore-issue-keystore-was-tampered-with-or-password-was-inc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!