Failed to sign APK package for android

When I build my first app for android with a brand new keystore, I get an error at the last stage of building.

CommandInvokationFailure: Failed to sign APK package.

stderr[
m was unexpected at this time.
]

Possible causes:
I have changed the project name / company name and game name many times, I have been able to build apk packages before with different keystores.

It seems to be just a basic naming error. but i’m not sure why.

i have the same bug. did you find a fix? have nev er been able to do this after formatting my computer…

CommandInvokationFailure: Failed to sign APK package.
C:\Users\bjorn\AppData\Local\Android\sdk\build-tools\26.0.1\apksigner.bat sign --ks “D:/UnityProjects/AR_2/user.keystore” --ks-pass pass:“123123” --ks-key-alias “123123” --key-pass pass:“123123” “D:\UnityProjects\AR_2\Temp/StagingArea/Package.apk”

stderr[
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:808)
at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCertsFromKeyStore(ApkSignerTool.java:700)
at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCerts(ApkSignerTool.java:646)
at com.android.apksigner.ApkSignerTool$SignerParams.access$500(ApkSignerTool.java:600)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:255)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88)
]
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()

Yes!
I fixed it by starting up Android Studio and updating it.
Try updating the android SDK.

I have the same issue. With the latest SDK i got the “Unable to list target platforms” error, and with a legacy SDK I got the “Failed to sign APK package” error.