• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by NinjaCalvin · Oct 02, 2017 at 06:08 PM · androidapkbuild errorkeystore

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.

alt text

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?

apksigning-oct1.png (14.3 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image NinjaCalvin · Oct 02, 2017 at 11:14 PM 1
Share

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

avatar image NinjaCalvin · Oct 03, 2017 at 05:30 PM 0
Share

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.

1 Reply

· Add your reply
  • Sort: 
avatar image
-1
Best Answer

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!!!

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Blue-Cut · Nov 22, 2017 at 11:50 AM 0
Share

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

alt text

error-gradle.png (9.5 kB)
avatar image NinjaCalvin · Nov 23, 2017 at 09:30 PM 0
Share

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!

avatar image NinjaCalvin · Nov 23, 2017 at 09:41 PM 0
Share

Also, the biggest thing was making sure you have the correct Android SD$$anonymous$$ Tools installed.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

148 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Keystore was tampered with, or password was incorrect 0 Answers

Package file was not signed correctly. 2 Answers

Signatures do not match even if using same debug.keystore file 0 Answers

Error while running keytool 1 Answer

Error in building and signing APK. 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges