使用现有的 .keystore 签署 Android apk
我使用的是 Eclipse,除了 windows->preferences->android->build 中指定的默认密钥库路径外,我没有在 eclipse 中指定任何其他自定义密钥库路径。
我在两个位置都有 debug.keystore。一个是默认路径,另一个是c:\customized_path。 但是,当我想生成证书时:
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 20000 它将在 java\bin 文件夹中生成 debug.keystore。
如果我尝试:
C:\Java\jdk1.6.0_25\bin>keytool -genkey -v -keystore C:\default_path\.android\d
ebug.keystore
keytool error: java.io.IOException: Invalid keystore format
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:3
8)
at java.security.KeyStore.load(KeyStore.java:1185)
at sun.security.tools.KeyTool.doCommands(KeyTool.java:620)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)
它也会在自定义路径中生成密钥时出现相同的错误。
我在两个文件夹中都有 debug.keystore 我仍然会有这个:
C:\Java\jdk1.6.0_25\bin>keytool -list
keytool error: java.lang.Exception: Keystore file does not exist: C:\customiesed_path\.keystore
和 C:\Java\jdk1.6.0_25\bin>keytool -list -keystore C:\the_default_path_specified_in_eclipse.keystore keytool错误:java.lang.Exception:密钥库文件不存在:C:\default_path
Eclipse正在使用默认文件夹中的.keystore来签署apk,并且我在默认文件夹中有.keystore,但它只是没有'当我尝试运行我的应用程序时,不允许我对其进行签名并给我带来烦人的错误。
有人可以帮忙吗?
I'm using Eclipse, and except for the default keystore path specified in windows->preferences->android->build, I didn't specify any other customized keystore path in eclipse.
I have the debug.keystore in two locations. one is in the default path, and the other say c:\customised_path.
however, when i wanted to generate the cert:
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 20000
it'll generate the debug.keystore in the java\bin folder.
and if i try:
C:\Java\jdk1.6.0_25\bin>keytool -genkey -v -keystore C:\default_path\.android\d
ebug.keystore
keytool error: java.io.IOException: Invalid keystore format
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:3
8)
at java.security.KeyStore.load(KeyStore.java:1185)
at sun.security.tools.KeyTool.doCommands(KeyTool.java:620)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)
it'll gimme the same error to generate the key in the customized path too.
i have debug.keystore in both folders still i'll have this:
C:\Java\jdk1.6.0_25\bin>keytool -list
keytool error: java.lang.Exception: Keystore file does not exist: C:\customiesed_path\.keystore
and
C:\Java\jdk1.6.0_25\bin>keytool -list -keystore C:\the_default_path_specified_in_eclipse.keystore
keytool error: java.lang.Exception: Keystore file does not exist: C:\default_path
Eclipse is using the .keystore in the default folder to sign the apk, and i have the .keystore in the default folder, but it just doesn't allow me to sign it and gives me annoying error when I try to run my application.
Could somebody help here please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
宾果!问题解决了!似乎 .keystore 发生了某种变化,在我重新下载它后,它又可以工作了。
我重新下载了我需要使用的.keystore并再次运行eclipse。现在一切正常。因此,下次有人在使用现有密钥生成 apk 文件时遇到问题时,请考虑在 eclipse 中“运行”而不是从 cmd 以及下载新的密钥库。
还有一件事:调试模式下的签名与发布模式下的签名不同! Eclipse 使用“run”来登录调试模式。使用命令行是行不通的,因为它们只是为了发布。
Bingo! problem solved! it seems that the .keystore is somehow changed and after I re-download it, it works again.
I re-downloaded the .keystore that I need to use and run eclipse again. Now everything works normal. So next time someone has problems generating apk file using an existing key, please take into consideration "run" in eclipse not from cmd as well as download a new keystore.
One more thing: signing in debug mode is different from release mode! Eclipse uses "run" to sign in debug mode. Using command line won't work because they're simply for release.