Cannot recover key [duplicate]

2019-01-08 20:25发布

问题:

This question already has an answer here:

  • Caused by: java.security.UnrecoverableKeyException: Cannot recover key 4 answers

I published the first version of my app in Play Store two days ago. I used a key with a known alias and password.

Then, I changed the name of my app in eclipse, just changed one letter. Now, I want to export version 2 in eclipse, try use the key from the first time and enter alias and passwort. I´m sure they are correct!!

On the last step, Eclipse tells me "Cannot recover key". I tried it with a new one but then the Play Store shows an error. What can I do??

EDIT:

Like you see in the second image abobe, it MUST be the right password because otherwise the alias would not be in the dropdownbox. Also the second password is correct, it´s a copy from the first. I only have one alias!

Destination APK file-link in the last picture doesn´t matter right?

回答1:

Solution: The KeyStore password and The Key password should be the same.

Changing both passwords using keytool

Change KeyStore password

keytool -storepasswd -new %newpassword% -keystore %YourKeyStore%.jks

replace %newpassword% with your actual password, same with YourKeyStore

Change Alias key Password

keytool -keypasswd -alias %MyKeyAlias% -new %newpassword% -keystore KeyStore.jks

Note: supply old passwords for both keystore and alias when asked for them

(quoted from http://karim-ouda.blogspot.com/2010/07/errors-solutions-5.html)



回答2:

If you have special characters in you passwords use this tool to change it:

http://keystore-explorer.org/

I've tried the commands on Windows and it didn't work(probably because of the special characters).



回答3:

Changing App Name doesn't create any problem while you signing the application. you might have entered a wrong password or keystore-alias.

And you cannot create a new keystore to sign the application. If you done so then it is another application and you cannot updated the currently existing application.

Try re-sign the app with First Keystore with proper keystore-alias and password. It may be hard for you but if you fail to re-sign with the first keystore file then you cannot update the app with second version.



回答4:

In my case the error was due a special character in the password: Ç.