Failed to sign APK, but gradle builds work?
I have gradle builds working but do not know how to run them on my Android device, but I would really like to be able to just use an APK file. I just made a new keystore in unity and I know the password is correct, its giving me this error:
CommandInvokationFailure: Failed to sign APK package. C:\Users\Matthew\AppData\Local\Android\Sdk\build-tools\27.0.3\apksigner.bat sign --ks "C:/Users/Matthew/Desktop/GAMES IN PROGRESS/Devember2017/Devember 2017/my.keystore" --ks-pass stdin --ks-key-alias "minegame" --key-pass stdin "C:\Users\Matthew\Desktop\GAMES IN PROGRESS\Devember2017\Devember 2017\Temp/StagingArea/Package.apk"
stderr[ Error: keywords 'java|openjdk version' not found in 'picked up java_tool_options: -df' Error: keywords 'java|openjdk version' not found in 'picked up java_tool_options: -df' Failed to load signer "signer #1" java.io.IOException: Invalid keystore format at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source) at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source) at sun.security.provider.KeyStoreDelegator.engineLoad(Unknown Source) at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(Unknown Source) at java.security.KeyStore.load(Unknown Source) at com.android.apksigner.ApkSignerTool$SignerParams.loadKeyStoreFromFile(ApkSignerTool.java:829) at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCertsFromKeyStore(ApkSignerTool.java:719) at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCerts(ApkSignerTool.java:659) at com.android.apksigner.ApkSignerTool$SignerParams.access$500(ApkSignerTool.java:611) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:266) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:89) Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 ] stdout[ Keystore password for signer #1: ] exit code: 2 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.Command.RunWithStdin (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg, System.String[] input) UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg, System.String[] stdin) 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) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Answer by matthew_gigante · May 20, 2018 at 10:05 PM
I had to install an sdk and jdk from past versions for my game to run.