DEV Community

Cover image for Don't use non-alphanumeric characters in Unity Keystore/Key password
IceTrooper
IceTrooper

Posted on

Don't use non-alphanumeric characters in Unity Keystore/Key password

Short note for Unity developers:

When I was trying to build my game for Android device with Google Play services used I got an error in a Unity console window. The error message looked really generic and I didn't know what I did wrong. Sometime later, I finally found a solution. Looks like non-alphanumeric characters in keystore/key passwords were the problem even that Unity doesn't tell you can't use them.

Possible errors:

java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key somegame from store "C:\Users\SomeUser\Documents\somekeystore.keystore": Cannot recover key

Fix

Don't use non-alphanumeric characters in passwords when publishing a game to Android devices.

First found solution:

Unity forum thread

Alright then removed the @ character from the password and it now works.

How can you change password?

If you want to change keystore password follow those steps:

  1. Locate C:\Program Files\Java\jdk1.8.0_202\bin to use keytool and open powershell there.
  2. Type command: ./keytool -storepasswd -new [newpassword] -keystore [filename.keystore] -storepass [currentpassword]

If you want to change key password follow those steps:

  1. Locate C:\Program Files\Java\jdk1.8.0_202\bin to use keytool and open powershell there.
  2. Type command: ./keytool -keypasswd -alias [keyalias] -keypass [currentpassword] -new [newpassword] -keystore [filename.keystore] -storepass [currentpassword].

To print keystore and keys infromation:
./keytool -list -v -keystore [filename.keystore]

If you want to pass keystore location, remember to use quotes, example: ./keytool -list -v -keystore "C:\Users\SomeUser\Documents\somekeystore.keystore"

Source: IBM support knowledge center
More keytool commands: Keytool docs


If I wrote something wrong, don't hesitate to correct me and write a comment. Hope that short note would help someone when publishing to Google Play.

Top comments (0)