godot-ci
godot-ci copied to clipboard
`java.io.IOException: Invalid keystore format`
When I build our Godot app with your CI for Android I get this:
...
ADDING: res/mipmap/icon_foreground.png
ADDING: resources.arsc
export: step 1: Adding files...
export: step 103: Aligning APK...
Starting signing of the APK binary using /usr/lib/android-sdk/build-tools/30.0.3/apksigner
export: step 104: Signing release APK...
Failed to load signer "signer #1"
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:666)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:57)
at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:224)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:71)
at java.security.KeyStore.load(KeyStore.java:1445)
at com.android.apksigner.SignerParams.loadKeyStoreFromFile(SignerParams.java:353)
at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:239)
at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
at com.android.apksigner.ApkSignerTool.getSignerConfig(ApkSignerTool.java:395)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:316)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88)
export: end
ERROR: Project export failed with error code 20 for preset "Android".
at: _fs_changed (editor/editor_node.cpp:801)
EditorSettings: Save OK!
I followed the steps in the documentation of the CI config to encode the key and all that. I verified multiple times now that the from base64 decoded key is exactly the same as the original non base64 key. I have no idea what this error means.
Did you generate the keystore with java 8? Apparently the version of the apksigner and the version used to generate the keystore has to match.
I did not use java 8 but java 11.
I'm not sure how to use Java 8 either.
I think you just have to set the environment variable JAVA_HOME
to a different directory with java 8.
So I did export JAVA_HOME="/nix/store/6aj4vbk6hnbi7hv6lq98xyv6ikz3q45c-openjdk-8u272-b10-debug"
and generated a new keystore with keytool
but it's giving the same error,
My bad, it isn't just setting JAVA_HOME
. You have to use the keytool
scripts of the correct JDK to use a different version. So in your case it should be in /nix/store/6aj4vbk6hnbi7hv6lq98xyv6ikz3q45c-openjdk-8u272-b10-debug/bin/keytool
.