r0adkll / sign-android-release

A GitHub action to sign an APK or AAB
MIT License
362 stars 137 forks source link

Unable to sign app #2

Closed kceb closed 4 years ago

kceb commented 4 years ago

Facing an issue after verification step. My keystore file does not have the .jks extension, instead it has the .keystore extension, but I was still able to base64 encode it. I've triple checked that my alias and keystore password was correct. I left out the key password option and I tried setting it to an empty string as well since I don't have a key password for my keystore. Any idea what I'm doing wrong? Does this action support keystores that have a keystore password, but do not have a key password?

Verification succesful
/usr/local/lib/android/sdk/build-tools/29.0.2/apksigner sign --ks android/app/build/outputs/apk/release/signingKey.jks --ks-key-alias *** --ks-pass pass:*** --key-pass pass: --out android/app/build/outputs/apk/release/app-release-signed.apk android/app/build/outputs/apk/release/app-release-aligned.apk
Failed to load signer "signer #1"
java.io.IOException: Failed to obtain key with alias "***" from android/app/build/outputs/apk/release/signingKey.jks. Wrong password?
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:320)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
    at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:277)
    at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:83)
Caused by: java.security.UnrecoverableKeyException: Cannot recover key
    at sun.security.provider.KeyProtector.recover(KeyProtector.java:315)
    at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:141)
    at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:56)
    at sun.security.provider.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:96)
    at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(JavaKeyStore.java:70)
    at java.security.KeyStore.getKey(KeyStore.java:1023)
    at com.android.apksigner.SignerParams.getKeyStoreKey(SignerParams.java:375)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:288)
    ... 3 more
##[error]The process '/usr/local/lib/android/sdk/build-tools/29.0.2/apksigner' failed with exit code 2
kceb commented 4 years ago

Seems like it had to do with the key password being required.

Made a PR here and tagged with 1.1.0. Feel free to edit/decline. In the meantime I will be using my forked version. Thanks for this action!

https://github.com/r0adkll/sign-android-release/pull/3

r0adkll commented 4 years ago

Merged!