入门Android的谷歌地图V2的发行版本的工作通过产生SHA1指纹API密钥 [英] Getting Android Google Map v2 working in release version by generating SHA1 fingerprint for API key

查看:240
本文介绍了入门Android的谷歌地图V2的发行版本的工作通过产生SHA1指纹API密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了很长时间,今晚试图找出如何让我的谷歌地图,在我的Andr​​oid应用程序的调试版本曾在发行版本的工作。有报道说,想出了几个不同的问题。堆栈溢出职位一些片断帮助,但我认为这将是列出更详细的整个过程是有用的,包括我的问题,这是:

I spent a long time tonight trying to figure out how to get my Google Map that worked in the debug version of my Android application to work in the release version. There were a few different problems that came up. Some fragments of Stack Overflow posts helped, but I thought it would be useful to list more detail for the whole process, including the problems I had, which were:

1)如何/你在哪里指定不同的东西为你的发行版?

1) How/where do you specify something different for your release version?

2)你如何运行,以获得发行版本指纹所需要的密钥工具的可执行文件?

2) How do you run the keytool executable needed to get the release version fingerprint?

3)为什么我得到密钥库文件存在,但为空的错误,当运行密钥工具?

3) Why was I getting the "keystore file exists but is empty" error when running keytool?

推荐答案

1)作为一对夫妇规定的其他堆栈溢出的职位,你可以使用两种调试同谷歌API密钥和发行版本,但你必须提供在谷歌开发者控制台调试和释放键的指纹。

1) As specified in a couple other Stack Overflow posts, you can use the same Google API key for both your debug and release versions, but you have to supply the fingerprints of your debug and release keys in the Google Developers Console.


  • 请到谷歌开发者控制台的 https://console.developers.google.com

  • 选择您适当的项目

  • 在左侧,选择下凭证API和放大器; AUTH

  • 假设你已经拥有Android应用程序生成的API密钥,你应该已经看到列为允许的应用,其调试指纹应用程序。点击编辑允许Android应用程序。

  • 您将需要添加另一条线路为您的应用程序,但其释放的指纹。要获得...

2)提及谷歌在该对话框,你需要运行

2) Google mentions in that dialog that you need to run

keytool -list -v -keystore mystore.keystore

不过,通过点击了解更多中去远一点,你真的要运行什么

But by clicking "Learn more" and going a little further, what you really want to run is

keytool -exportcert -alias MY_RELEASE_KEY_ALIAS -keystore MY_FULL_PATH_TO_RELEASE_KEYSTORE_FILE -list -v

然后,你会被要求输入密钥存储密码。未在文档提到的一个段子,其中密钥工具程序。它在你的JDK bin文件夹。所以在Windows上,像C:\\ Program Files文件\\的Java \\ jdk1.8.0_20 \\ BIN

Then you'll be asked for your keystore password. One piece that isn't mentioned in the docs is where the keytool program is. Its in your JDK bin folder. So on Windows, something like C:\Program Files\Java\jdk1.8.0_20\bin

3)后,我在Java bin文件夹中打开一个控制台窗口并运行密钥工具如上,我得到一个错误,说密钥库文件存在,但为空。最终,我意识到,指定的完整路径我释放密钥存储文件的时候,我只指定的文件夹名称,但忘了,包括实际的文件名,即使有该文件夹中只有一个文件。所以MY_FULL_PATH_TO_RELEASE_KEYSTORE_FILE上面应包括的.keystore文件名

3) After I opened a console window in the Java bin folder and ran the keytool as above, I was getting an error that said "keystore file exists but is empty". Eventually I realized that when specifying the full path to my release keystore file, I had only specified the folder name but forgot to include the actual file name, even though there was only one file in the folder. So MY_FULL_PATH_TO_RELEASE_KEYSTORE_FILE above should include the .keystore file name

毕竟,你最终将提供几个手印,包括SHA1。您可以复制,回去并粘贴在允许Android应用程序的新行,您的包名上月底由分号分隔,就像调试之一。

After all that, you will be finally be provided with several fingerprints, including the SHA1. You can copy that, and go back and paste it as a new line in the allowed Android Applications, with your package name on the end separated by a semi-colon, just like the debug one.

这篇关于入门Android的谷歌地图V2的发行版本的工作通过产生SHA1指纹API密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆