获取 Google 地图 API 密钥
我使用的是 Windows 7。
我已经尝试多次使用出现在 c:\users\YOURUSER.android\ 中的 debug.keystore 使用命令:
keytool -list -alias androiddebugkey -keystore c:\Users\YOURUSER\.android\debug.keystore -storepass android -keypass android
它给了我一个 MD5,但后来我转到 Google MD5 注册页面,它说这不是有效的指纹。
我搜索了更多信息,最后在 c:\users\YOURUSER\ 中创建了一个新的 debug.keystore 以避免重写原始密钥。我使用了这个命令:
keytool -genkey -keypass android -keystore c:\users\YOURUSER\debug.keystore -alias androiddebugkey -storepass android -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
它有效,所以我使用前面的命令来获取MD5,它给了我一个新的MD5。然后我再次去谷歌,遇到同样的问题:“不是有效的指纹”。
我做了第二次尝试。这就是我当时所做的: 1)打开Windows7终端,进入c:\program files\java\jdk1.7.0\bin\ 2) 写入命令:
keytool -genkey -v -keystore c:\eclipse\my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
3) 然后我尝试使用 comand: 从我的密钥库获取 MD5 代码:
keytool -list -alias alias_name -keystore c:\eclipse\my-release-key.keystore
并写入要求的密码。它给了我一个MD5。
4)我去maps api key注册并写入MD5。 “指纹无效”
我不知道问题是什么。我应该为我编写的每个应用程序执行此操作吗?真让人头疼啊!
有人可以帮我吗?
I'm using Windows 7.
I have tried several times with the debug.keystore with appears in c:\users\YOURUSER.android\ using the command:
keytool -list -alias androiddebugkey -keystore c:\Users\YOURUSER\.android\debug.keystore -storepass android -keypass android
It gives me a MD5, but then I go to Google MD5 registration page and it sais it is not a valid fingerprint.
I searched for more information, and I finally created a new debug.keystore into c:\users\YOURUSER\ to avoid rewriting the original one. I used this command:
keytool -genkey -keypass android -keystore c:\users\YOURUSER\debug.keystore -alias androiddebugkey -storepass android -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
It works, so I use the previous command to get the MD5, and it gives me a new MD5. Then I go to Google again and the same problem: "not a valid fingerprint".
The I made a second attempt. This is what I did then:
1) Opened a Windows7 terminal, went to c:\program files\java\jdk1.7.0\bin\
2) Wrote command:
keytool -genkey -v -keystore c:\eclipse\my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
3) Then I tried to get the MD5 code from my keystore, using comand:
keytool -list -alias alias_name -keystore c:\eclipse\my-release-key.keystore
and writing the password I am asked. It gives me a MD5.
4) I go to maps api key sign up and write the MD5. "FINGERPRINT NOT VALID"
I don't know what the problem is. And I am supposed to do this for every app I program? What a headache!
Can anybody help me please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您确定您获得的是 MD5 而不是 SHA1 指纹吗?尝试过 -v 选项吗?
请参阅:如何我从 Java 的 keytool 获取 MD5 指纹,而不仅仅是 SHA-1?
Are you sure you get the MD5 and not the SHA1 fingerprint? Tryed the -v option?
see: How can I get the MD5 fingerprint from Java's keytool, not only SHA-1?
谷歌地图已弃用其先前版本的 API v1,并引入了新版本的谷歌地图 API v2。
之前我们生成了 md5 密钥,但现在我们需要生成 sha-1 指纹证书。
Maps API 密钥基于应用程序数字证书的简短形式,称为 SHA-1 指纹。指纹是由常用的 SHA-1 哈希算法生成的唯一文本字符串。由于指纹本身是唯一的,因此 Google 地图使用它来识别您的应用程序。
请浏览对您有帮助的链接
https://developers.google.com /maps/documentation/android/start#the_google_maps_api_key
https://developers.google.com/maps/documentation/android/intro#sample_code
也可以在 stack over flow 中看到相同类型的帖子
如何实施 Google 地图新版 API v2
google maps has deprecated its previous version API v1 and introduced a new version of google maps API v2.
previously we generated md5 key but now we need to generate sha-1 fingerprint certificate.
The Maps API key is based on a short form of your application's digital certificate, known as its SHA-1 fingerprint. The fingerprint is a unique text string generated from the commonly-used SHA-1 hashing algorithm. Because the fingerprint is itself unique, Google Maps uses it as a way to identify your application.
please go through the links it could help you
https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key
https://developers.google.com/maps/documentation/android/intro#sample_code
also see the same kind of post in stack over flow
How to implement Google Maps new version of API v2
对我来说,它是“C:\ Program Files \ Java \ jdk1.7.0_03 \ bin”
因此命令行中的最终字符串必须如下所示:
“C:\ Program Files \ Java \ jdk1.7.0_03 \ bin>keytool -list -v -keystore C:\ Users \ John \ .android \ debug.keystore”。通常你只需要更改名称“John”
就会有 SHA-1、MD5 等
最后,转到 Google Access API Google 访问 API
as for me it is "C:\Program Files\Java\jdk1.7.0_03\bin"
So the final string in command line must look like:
"C:\Program Files\Java\jdk1.7.0_03\bin>keytool -list -v -keystore C:\Users\John\.android\debug.keystore". Whare usually u need only to change the name "John"
There will be SHA-1, MD5, etc
Finally, go to Google Access API google access api