无法在Android Studio中导出签名的APK [英] Unable to export signed APK in Android Studio
问题描述
当我使用
keytool -list -keystore /path/to/keyfile.jks
并输入密码,就可以在其中看到该条目,但是当我尝试使用相同的密码生成签名的APK时使用相同的密码时,会收到错误消息
When I use
keytool -list -keystore /path/to/keyfile.jks
and give my password, I'm able to see the entry there, but when I use the same password while trying to Generate signed APK using the same password, I get the error
无法加载密钥库:密钥库被篡改或密码错误
Cannot load key store: Keystore was tampered with, or password was incorrect
请帮助!
推荐答案
经过20个小时的不懈搜索,得到了答案. 显然字符&"存在一些问题在此处提到的密码中 https://code.google.com/p/android/issues/detail?id = 36350 尽管在我的情况下,字符为"@".
Got the answer after 20 hours of tireless searching. Apparently there is some issue with the character '&' in passwords as mentioned here https://code.google.com/p/android/issues/detail?id=36350 Although in my case, the character was '@'.
对于任何陷入困境的人,这就是我所做的事情(也应该对他们有用)
For anyone who gets stuck, here is what I did (and what should work for them too)
- 我使用
keytool -keypasswd -alias <key_name> -keystore mykeystorek.jks
命令更改了密钥别名密码的密码. - 由于我怀疑原始文件有问题,因此我认为最好将密钥导出到另一个文件.我使用
keytool -importkeystore -srckeystore my.keystore.jks -destkeystore new.keystore -deststoretype pkcs12
,然后使用keytool -importkeystore -srckeystore new.keystore -srcstoretype pkcs12 -destkeystore final.keystore -deststoretype jks
.
- I used the
keytool -keypasswd -alias <key_name> -keystore mykeystorek.jks
command to change password for my key alias password. - Since I suspected my original file had some issues, I thought it best to export the keys to another file. I did that using
keytool -importkeystore -srckeystore my.keystore.jks -destkeystore new.keystore -deststoretype pkcs12
followed bykeytool -importkeystore -srckeystore new.keystore -srcstoretype pkcs12 -destkeystore final.keystore -deststoretype jks
.
它的作用是,以PKCS12格式导出原始密钥库值,然后以文件名final.keystore返回Java密钥库格式.在所有这些命令中,提示符都要求输入新的目标密码,我小心翼翼地选择了该密码,避免使用@
和&
.
What this does is, export the original keystore values in PKCS12 format, and then back to Java Keystore format in the filename final.keystore. In all these commands, the prompt asked for new destination password, which I carefully chose, avoiding @
and &
.
现在就可以使用! 如上面共享的链接所示,这似乎是由于SDK Tools 20中推送了一些更新所致.我知道这很不好. 其他应用程序所有者似乎也对Google感到非常生气. :(
And it works now! As indicated in the link shared above,this seems to be due to some update pushed in SDK Tools 20. I know it's bad. The other app owners seem pretty pissed at Google too. :(
这篇关于无法在Android Studio中导出签名的APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!