Android keystore stopped working

前端 未结 8 1075
无人共我
无人共我 2020-12-02 17:01

Just recently I have had a problem with a key store. I know there are plenty of questions about this problem already. I have read them all and Googled furiously.

Er

相关标签:
8条回答
  • 2020-12-02 17:07

    I will suggest couple of more heat and trials.

    Have patience to apply these,

    Steps:

    1. Untick the build automatically (Project-> Build Automatically) in eclipse and clean your project.
    2. Build it again.(Right Click on the project+Build Project)
    3. Export Project.
    4. Select Android Export.(auto aligned for you)
    5. Choose your key. provide the password. alias should come in the list.(Be sure about the caps lock). Sometimes we give correct password but due to caps it always fails ;)
    6. Let me know if it works for you.

    Hopes this will help you.

    0 讨论(0)
  • 2020-12-02 17:09

    I may have had the same problem. I never did figure out why it was failing (though I wonder if it was because the keystore password was shorter than 6 digits), but I was able to copy my key into a new keystore, which I then renamed to replace the old one, and it mysteriously worked after that (using the new passwords). Needed the key password, by the way. Working off https://security.stackexchange.com/a/3795, I did the following:

    1. keytool -importkeystore -srckeystore old.keystore -destkeystore new.keystore -v
    2. Entered the new keystore password twice
    3. Hit Enter when it asked me for the source keystore password (left it blank)
    4. Entered the key password

    After double-checking that the new one worked, I just copied it over the old one. Hope it works for you; good luck.

    0 讨论(0)
  • 2020-12-02 17:18

    Try to remove .metadata folder in your workspace and clear all temp folders. If your keystore file isn't damaged and you have tried to reinstall Eclipse, ADT, Android SDK and Java SDK correctly, I don't see other possibly causes for this strange issue excluding .metadata cache files and\or some temp corruption.

    Another suggestion

    Try to use Portecle an utility for managing and examining keystores, keys, certificates, certificate requests, certificate revocation lists etc.

    0 讨论(0)
  • 2020-12-02 17:20

    I battled this issue as well recently, and tried all suggestions listed here and elsewhere. Finally identified a silly mistake that was causing this error at my end - I wanted to share this here in case it helps any of you.

    This is more likely to be the case if you, like me, have multiple Java versions on your machine and had upgraded JRE / JDK between the time you originally created the keystore and now when you're trying to sign the APK.

    For some reason, our compile instructions were referencing the full Java path like this:

    C:\Progra~1\Java\jdk1.6.0_45\bin\jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore cre80ve.keystore unsigned.apk cre80ve

    One of the suggestions above got me thinking that it might not be a password issue at all, and it could be version incompatibilities causing the issue. So I ran the below command :

    keytool -list -keystore cre80ve.keystore

    Using the password that I knew was correct, and lo and behold, it confirmed that it was the right password.

    I then dropped the explicit reference in the path to the (older) Java version. This made it automatically pick up the latest version of Java (jdk1.8.0_31 in my case):

    jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore cre80ve.keystore unsigned.apk cre80ve

    And everything started working fine!

    Bottomline: it may not be a password issue at all, but different versions of Java or the Android SDK causing the issue, so remember to check that out.

    And once it starts working, remember to backup your keystore and password in a safe place :-)

    0 讨论(0)
  • 2020-12-02 17:21

    Are you storing values such as key.store.password or key.alias.password in your local.properties file? Are either of those incorrect?

    I'm curious if there's some bug that occurs for keys created with JDK6 and verified in JDK7 - It would explain why the new keys you created for testing work, but the old one doesn't. Try downgrading to JDK6 and see if that fixes it- Others have had jarsigner trouble in JDK7 that went away when they downgraded to 6. If that works, file a bug report and demand a patch so you can safely upgrade to Java 7 :)

    0 讨论(0)
  • 2020-12-02 17:22

    Just had this issue - all of a sudden Android Studio forgot my passwords and wouldn't use the ones I had in the gradle file. I've had the same keyfile and passwords in the same project for 6 years!

    So I entered them manually - but it failed verification time after time. I tried some things like invalidating caches, restarting Android Studio and restoring a backup of the keystore but nothing helped.

    Finally in pure desperation I tried to switch the keystore password and the key password. Lo and behold - it worked! Turns out I had switched the passwords when I entered them into the Gradle build file a few years ago, and for some reason I never noticed.

    Conclusion: never be 100% sure that you're doing it right.

    0 讨论(0)
提交回复
热议问题