- Home /
Unity is saying my keystore password is wrong
Hello everyone, yesterday I tried to use a keystore while building my game (to android). However, Unity always thinks that the password I inputted is wrong, even though I have made sure it is not. It could also be in the path, as Unity keeps saying
Unable to create key in keystore. Please make sure the location and password of the keystore is correct.
So what do I do? I have been trying for hours and hours, so any input would be truly awesome.
EDIT: I can work around this first error (the one that doesn't allow me to select the alias), but when I try to build it it then displays these:
FAILURE: Build failed with an exception.
Execution failed for task ':packageRelease'.
> Failed to read key alias from store "C:\Keystore\user.keystore": Keystore was tampered with, or password was incorrect
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0a14\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\28.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0a14\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0a14\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.1.0a14\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
:compileReleaseAidl NO-SOURCE
:compileReleaseNdk NO-SOURCE
:processReleaseJavaRes NO-SOURCE
:packageRelease FAILED
28 actionable tasks: 5 executed, 23 up-to-date
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2019.1.0a14\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.1.0a14\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
UnityEditor.BuildPlayerWindow+BuildMethodException: 56 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00234] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:190
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:96
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
(I left out a few "UP-TO-DATE" messages)
Sorry for all this text, but I think it can be useful when dealing with this. Again, any input would mean the world to me.
Answer by Larry-Dietz · Dec 02, 2019 at 10:44 PM
If this is an unpublished game, there is no harm that I can think of, to just creating a new keystore, and resigning the game.
So that is what I would recommend doing. Just create a new one, and be very careful when creating a password for the new keystore, so you can be sure you are using the correct one.
Oh, I have done that more times than I could count already. Used passwords without symbols. Without capitals. Without symbols and capitals. I even just copy and pasted them everywhere to make sure it was 100% correct.
After you created the keystore, have you verified that the keystore file is there? I am wondering if you are dealing with a write permissions issue, and the file is failing to get created?
Oh, they're definitely there, as seen through the file explorer. I don't know why this is happening...
Answer by pigaroos · Dec 05, 2019 at 12:12 PM
Alright, so Larry and I found a solution to this, if anyone needs it. It goes like this:
1.Create a new keystore through the Keystore Manager in Unity
2.Move it to where your keytool.exe is located, usually it's in C:\Program Files (x86)\Java\jre1.8.0_181
3.Open Command Prompt
4.type in cd\
5.type in cd "Program Files (x86)"\Java\jre1.8.0_181\bin
6.type in keytool -keypasswd -alias [your alias] -storetype [your storetype, probably jks] -keystore [your keystore file name, include the extension]
7.type in your keystore password between single quotes (important)
8.type in the key password that you typed in Unity (without any quotes)
9.retype it
10.If no errors show up, go back to Unity
11.Check the "Custom Keystore" box
12.from now on, order is extra important
13.Select your keystore file name (not browse) in the dropdown below the checkbox (if it doesn't show up, change the Dedicated Keystore location in Edit > Preferences > External Tools to the one on step 2)
14.Type in the keystore password that you used when creating the keystore in the keystore password field
15.From the alias dropdown below, select your alias
16.Type in the alias password that you changed to in the command prompt (if you used the same one as before on the command prompt then use that)
17.After both passwords are in, change the keystore password to your keystore password but between single quotes (for example, if my password is ab1234, then it would be 'ab1234')
18.Click Build in Build Settings
19.Enjoy your build!
If I'm getting this correct, the issue arises from Unity incorrectly passing parameters to the keystore exe. It's appending and prefixing a single quote to the start and end of the password? Am I right?
Answer by bleater · Sep 15, 2021 at 08:57 AM
The thing that I found critical was setting the keystores default location in Unity's preferences, so that I could then select the actual keystore from the dropdown list. Using "browse" never worked. Thanks!
Answer by DadNapper · Apr 18 at 08:19 AM
After upgrading Unity to 2021, Unity didn't accept my keystore password even I typed it correctly. I saw on other posts that this could be due to using special characters in the keystore password. To fix the issue I did the following:
1) Installed Keystore Explorer
2) Opened my old keystore file in Keystore Explorer by entering my keystore password
3) Then I right-clicked on the certificate and selected "unlock". Then entered password to unlock it.
4) Right clicked on the certificate and selected "copy"
5) Created a brand new keystore (File > New > JSK) and pasted the certificate (right click > paste)
5) Assigned a new password for the certificate via right-click (avoided special characters this time)
6) Saved the new keystore (which required a new password)
7) Then reimported the keystore into Unity! Done!
Hope this helps somebody!