Android:定位debug.keystore时命令行出现keytool错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2639275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android: keytool error on the command line when locating debug.keystore
提问by Capsud
I'm trying to generate the MD5 fingerprint from the debug.keystore
file using keytool.exe in my JDK so I can use Google Maps in my Android project.
I've located the keystore file and have moved it into C:\android
just to make things easier.
我正在尝试debug.keystore
使用 JDK 中的 keytool.exe从文件中生成MD5 指纹,以便我可以在我的 Android 项目中使用 Google 地图。我已经找到了密钥库文件并将其移入C:\android
只是为了让事情变得更容易。
Then in a command prompt I type
然后在命令提示符中我输入
c:\Program Files\Java\jdk1.5.0_13\bin>keytool -list -alias androiddebugkey -keystore "C:\android\debug.keystore" -storepass android -keypass android
And I keep getting the error:
我不断收到错误消息:
keytool error: java.lang.Exception: Keystore file does not exist: C:\android\debug.keystore
I've also tried entering the keystore in from its original location rather than moving to c:\android
but I still get the same error.
我还尝试从其原始位置输入密钥库而不是移动到,c:\android
但我仍然遇到相同的错误。
Does anyone have any idea why this is happening? Also, is there any other way to get this MD5 fingerprint? Some program maybe?
有谁知道为什么会这样?另外,有没有其他方法可以获得这个MD5指纹?也许是一些程序?
回答by Hiren Dabhi
to generate debug.keystore file
生成 debug.keystore 文件
in Eclipse/ADT, go to Windows > Preferences > Android > Build
在 Eclipse/ADT 中,转到 Windows > Preferences > Android > Build
once it is generated use ur command(c:\Program Files\Java\jdk1.5.0_13\bin>keytool -list -alias androiddebugkey -keystore "C:\android\debug.keystore" -storepass android -keypass android) to generate MD5.
生成后使用您的命令(c:\Program Files\Java\jdk1.5.0_13\bin>keytool -list -alias androiddebugkey -keystore "C:\android\debug.keystore" -storepass android -keypass android) 生成MD5。
this is used to generate api key for google map.
这用于为谷歌地图生成 api 密钥。
回答by Daniel Ponce
You should execute the keytools from c:\Program Files (x86)\java\jre6\bin>
您应该从 c:\Program Files (x86)\java\jre6\bin>
And here execute the keytool command without "\"
在这里执行没有“\”的keytool命令
keytool -list -alias androiddebugkey -keystore C:\Users\<you_user_name>\.android\debug.keystore -storepass android -keypass android
It will work!
它会起作用!
回答by CommonsWare
You might try adding c:\Program Files\Java\jdk1.5.0_13\bin
to your PATH
, then running the keytool
command from the C:\android directory
. That's what I do (more or less -- I have JDK6 and a different directory), and it works fine.
您可以尝试添加c:\Program Files\Java\jdk1.5.0_13\bin
到您的PATH
,然后keytool
从C:\android directory
. 这就是我所做的(或多或少——我有 JDK6 和一个不同的目录),它工作正常。
回答by Saurabh M. Chande
There are times when your .android folder is present in the C:\Documents and Settings
path. Often, because of the spaces in Documents and Settings
, the command will not run properly.
有时您的 .android 文件夹存在于C:\Documents and Settings
路径中。通常,由于 中的空格Documents and Settings
,命令将无法正常运行。
It's better if you just create a test folder under C:
and put your debug.keystore
file in this folder. Then give the path as:
如果你只是在下面创建一个测试文件夹C:
并将你的debug.keystore
文件放在这个文件夹中会更好。然后给出路径:
keytool -list -alias androiddebugkey -keystore "C:\test\debug.keystore" -storepass android -keypass android
This works. If somebody is facing issues and getting an error on this command, you can try your luck with this.
这有效。如果有人遇到问题并在此命令上出错,您可以试试运气。
回答by banjo_quint
I had the same message and when checking the C:\user.android directory could see that the debug.keystore file was not present. As this was the first time I'd tried an android project on this machine, there had been no previous builds. I created and ran the ubiquitous 'Hello World' project and debug.keystore was instantly created. I then ran keytool and the MD5 appeared fine
我有同样的消息,当检查 C:\user.android 目录时可以看到 debug.keystore 文件不存在。由于这是我第一次在这台机器上尝试 android 项目,以前没有构建过。我创建并运行了无处不在的“Hello World”项目,并立即创建了 debug.keystore。然后我运行了 keytool 并且 MD5 看起来很好
回答by toha
To generate the debug.keystore, you have to run any app at least one time. Just create and run any simple "Hello World" android app to generate it.
要生成 debug.keystore,您必须至少运行任何应用程序一次。只需创建并运行任何简单的“Hello World”Android 应用程序即可生成它。
Create Hello World android App
Run Hello World android app
创建 Hello World android 应用程序
运行 Hello World android 应用程序
回答by Goodlife
First i wentto the bin directory and then
首先我去了 bin 目录,然后
get where your debug.key is ..mainly at the .android and it worked like a charm
找到您的 debug.key 所在的位置 .. 主要在 .android 上,它就像一个魅力
where androiddebugkey is the name you give
其中 androiddebugkey 是您提供的名称
C:\Program Files\Java\jdk1.8.0_66\bin>keytool -exportcert -list -v -alias androiddebugkey -keystore C:\Userskeytool error: java.lang.Exception: Keystore file does not exist: C:\android\debug.keystore
1557\.android\debug.keystore
回答by Mark B
Tells me that file isn't there like you think it is.
告诉我该文件并不像您想象的那样存在。
Also, if you are using the Eclipse Android tools, you can export a signed APK file via Eclipse, which might be easier for you than using the command line tools.
此外,如果您使用 Eclipse Android 工具,则可以通过 Eclipse 导出已签名的 APK 文件,这可能比使用命令行工具更容易。