我知道已有这样的问题,但我找不到任何可以帮助我的答案。
我正在尝试使用此命令获取我必须拥有MD5密钥的Google Maps API密钥:
keytool -list -v -alias androiddebugkey -keystore "/Users/Sachin Parashar/.android/debug.keystore" -storepass android -keypass android
但它给出了这个错误:
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
java.io.IOException: Keystore was tampered with, or password was incorrect
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:780)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:56)
at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:225)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
at java.security.KeyStore.load(KeyStore.java:1445)
at sun.security.tools.keytool.Main.doCommands(Main.java:792)
at sun.security.tools.keytool.Main.run(Main.java:340)
at sun.security.tools.keytool.Main.main(Main.java:333)
Caused by: java.security.UnrecoverableKeyException: Password verification failed
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:778)
... 7 more
有谁知道这个命令有什么问题?
答案 0 :(得分:10)
阅读stacktrace。当您的密码错误时会引发此错误。
当您正在处理debug
密钥库时,可以将其删除并创建一个新密钥库。
首先,删除此文件
/Users/Sachin Parashar/.android/debug.keystore
然后,运行(在同一文件夹,即/Users/Sachin Parashar/.android/
)
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
最后,您可以运行您之前尝试的内容
keytool -list -v -alias androiddebugkey -keystore "/Users/Sachin Parashar/.android/debug.keystore" -storepass android -keypass android