- Home /
Failed to sign APK package (Unity 2017)
Hi there,
Using: Unity 2017, Android Studio 2.3.2 BuildTools 25.0.3 ( API 23, 24,25,26 installed
Oh, BTW, I also have Build Tools 23.0.1, 23.0.2, 23.0.3 and 24.0.3 installed.
I've recently gotten a new computer, and decided to update Unity and all that good stuff. The problem is that it fails to build on this new computer. (Same project file directory structure and names)
It's trying to tell me that my Keystore has been tampered with, or that my password is wrong. I know my passwords are correct, I have them written down, just in case of something like this.
I get the following errors:
CommandInvokationFailure: Failed to sign APK package.
[My keystore info here]
stderr[ Failed to load signer "signer #1" java.io.IOException: Keystore was tampered with, or password was incorrect at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:780) at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:56) at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:224) at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70) at java.security.KeyStore.load(KeyStore.java:1445) at com.android.apksigner.ApkSignerTool$SignerParams.loadKeyStoreFromFile(ApkSignerTool.java:734) at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCertsFromKeyStore(ApkSignerTool.java:636) at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCerts(ApkSignerTool.java:580) at com.android.apksigner.ApkSignerTool$SignerParams.access$200(ApkSignerTool.java:534) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:229) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:87) Caused by: java.security.UnrecoverableKeyException: Password verification failed at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:778) ... 10 more ] stdout[
] exit code: 2 UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg) UnityEditor.Android.PostProcessor.Tasks.BuildAPK.SignPackage (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.Tasks.BuildAPK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.HostView:OnGUI()
Any help?
O$$anonymous$$, so I've found this tool: http://keystore-explorer.org/downloads.html
I was able to check to see if my keystore was corrupt, or password wrong, so I load it up, and it says that the password is incorrect or the file is corrupt. SO I tried swapping the keystore and alias passwords and it let me in! I must have forgot which was which! Noob mistake, but THEN I tried to build and got the same error again!
So, at least I know my keystore is NOT corrupt and my passwords were correct (just accidentally swapped).
Again, any help is highly appreciated! I do NOT want to unpublish my app from the Play Store and make a new key if at all possible! I have built this same project before without error, so not sure what the issue is..
O$$anonymous$$, so I've tried building with Gradle, and I don't get the keystore errors, but I DO seem to have "12 duplicate class definitions". And some unresolved class warnings..
Looks like someone else had this same issue here: http://answers.unity3d.com/questions/1397172/gradle-build-errors.html
This may be the way I need to go anyway if I want to use a couple Google Plugins.
Answer by NinjaCalvin · Oct 03, 2017 at 07:02 PM
Ok, so followed this here below and got a successful build: http://answers.unity3d.com/question...rrors.html?childToView=1408656#answer-1408656
I did get a keystore error, but it said my Alias did not exist in the keystore file, so I just recreated the Alias exactly as it was before, and WORKED!!!
Hi NinjaCalvin, the link in your answer seems dead, could you please explain how you solved the issue? I am meeting the same and the "Gradle" solution I have read on other post doesn't work at all for me, I still have:
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Java\jdk1.8.0_60\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.Gradle$$anonymous$$ain "assembleRelease"
But I am sure my file is ok...
Well, I thought it had worked.. but I just ended up having to create a new keystore, and therefore deactivating my previous project, and submitting a new version using my new keystore.
I had created a new keystore before I had submitted my game to the playstore, so I was ok then, but after I made some major additions it was too late, and I realized I was using a different keystore the first time I submitted my game.
SO lesson learned. As for everything else, I couldn't tell you other than do not forget your password, and write it down somewhere not on your computer.
Also, since I'm trying to get Facebook SD$$anonymous$$ working, I'm back to Unity 5.6.3 trying to give it a go. I now have both versions installed. See how it goes. Unfortunate, because everything else was working great in 2017!
Also, the biggest thing was making sure you have the correct Android SD$$anonymous$$ Tools installed.