生成APK时出现“无法恢复密钥”错误

时间:2020-02-07 08:59:01

标签: android android-studio terminal apk

生成签名的APK时出现以下错误:

 Caused by: java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key key0 from store "/Users/zorgan/Desktop/keystore": Cannot recover key

 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 java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:473)
        at sun.security.provider.KeyStoreDelegator.engineGetEntry(KeyStoreDelegator.java:172)
        at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetEntry(JavaKeyStore.java:70)
        at java.security.KeyStore.getEntry(KeyStore.java:1521)
        at com.android.ide.common.signing.KeystoreHelper.getCertificateInfo(KeystoreHelper.java:191)
        ... 32 more

我已经检查了executionHistory.bin文件,并确认密钥库密码和密钥密码正确无误,并且都是相同的密码:

enter image description here

signingConfig.keyAliasÖkey0ösigningConfig.keyPasswordí**mypassword**úsigningConfig.storePasswordí**mypassword**òsigningConfig

enter image description here

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

与此处的许多答案相反,密钥库密码密钥密码必须不同:

enter image description here

我的Keystore密码正确,但是我必须为Key密码(Alias密码)尝试其他密码。最终成功了。