51

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:

enter image description here

enter image description here

enter image description here

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?

user896692
  • 2,351
  • 7
  • 36
  • 57

4 Answers4

131

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)

TylerH
  • 20,799
  • 66
  • 75
  • 101
Mustafa Güven
  • 15,526
  • 11
  • 63
  • 83
  • 5
    Thanks a lot! But WHY would they make it that way? – Sagar Sodah Jan 28 '15 at 10:09
  • I have the same problem. I remember while I was exporting the signed application Eclipse froze. But the generated certificate seems okay. Now Im trying to upload an update but there is a problem with the update. I've tried to change it and I get the same error as you. Any suggestions? – Foo Jun 21 '15 at 14:26
  • The had stopped being the case in recent builds of Studio, seems to be back again in Android Studio 1.4, but using the same password fixes it. – Longmang Oct 14 '15 at 16:21
  • 10
    Using the second command I get this error: `java.security.UnrecoverableKeyException: Cannot recover key` – JCarlosR Apr 08 '16 at 18:23
  • I have encountered the same problem but I solved it differently. My problem was that I did not specify both the keystore and key password but the former only, and the implementation tries to open the key with the keystore password - this fails if the two are different. – reim Jul 21 '16 at 15:11
  • This is really strange (and stupid). I have never had problems with this for years of using one keystore for a few of my apps. Now after upgrading to a new notebook, it suddently doesn't work anymore (why? on the previous notebook I've went through Eclipse and many different versions of Android Studio). – Czechnology Aug 27 '16 at 15:33
  • Fortunately, I was able to change the keystore password as described here but it means that I now have to have multiple copies of the keystore, each with a different password, matching the key I want to use! So why is it even possible to have multiple keys in one keystore (with different passwords)? – Czechnology Aug 27 '16 at 15:35
  • 1
    Its giving this error still now in my case: `keytool error: java.security.UnrecoverableKeyException: Cannot recover key` – 0xAliHn Nov 20 '16 at 17:38
  • Interesting how it's explicitly mentioned in [Android documentation](https://developer.android.com/studio/publish/app-signing#generate-key) that these two passwords should be different – Ehsan Khaveh Jun 18 '20 at 11:58
  • 1
    Using the same password is also required by SoapUI – m7913d Sep 28 '21 at 19:52
13

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).

enter image description here

Community
  • 1
  • 1
Florin Birgu
  • 495
  • 7
  • 12
7

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.

TNR
  • 5,839
  • 3
  • 33
  • 62
  • Thanks for your answer. I you think that that doesn´t create any problem, is there any way to show the password I used? Probably not.. – user896692 Jan 30 '13 at 15:02
0

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

tato.rodrigo
  • 2,783
  • 21
  • 26