与Google api连接 [英] connect with Google api

查看:62
本文介绍了与Google api连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要MD5指纹键

我生成了密钥存储区,但全部都只生成了SHA1密钥...

如何获取MD5密钥.

I need a MD5 finger print key

i generate the key store and all but it generate only SHA1 key...

how can i get a MD5 key.

推荐答案

获取签名证书的MD5指纹

有关使用Keytool和Jarsigner签名应用程序的更多信息,请参阅Android Developers网站上的对应用程序签名".

要注册Maps API密钥,您需要提供将用于签署应用程序的证书的MD5指纹.在访问注册页面之前,请使用Keytool生成相应证书的指纹.

首先,确定在发布时将使用哪个密钥对应用程序进行签名,并确保包含该密钥的密钥库的路径.

接下来,对目标密钥库和密钥别名使用-list选项运行Keytool.下表列出了您应该使用的选项.
键盘工具选项说明
-list打印证书的MD5指纹.
-keystore< keystore-name> .keystore包含目标密钥的密钥库的名称.
-storepass<密码>

密钥库的密码.

为安全起见,除非您在安全的计算机上工作,否则请不要在命令行中包含此选项.如果未提供,Keytool会提示您输入密码.这样,您的密码就不会存储在您的Shell历史记录中.
-alias< alias_name>为其生成MD5证书指纹的密钥的别名.
-keypass<密码>

密钥的密码.

为安全起见,除非您在安全的计算机上工作,否则请不要在命令行中包含此选项.如果未提供,Keytool会提示您输入密码.这样,您的密码就不会存储在您的Shell历史记录中.

这是Keytool命令的示例,该命令为密钥库my-release-key.keystore中的密钥alias_name生成MD5证书指纹:

Getting the MD5 Fingerprint of Your Signing Certificate

For more information about using Keytool and Jarsigner to sign your application, see Signing Your Applications on the Android Developers site.

To register for a Maps API Key, you need to provide an MD5 fingerprint of the certificate that you will use to sign your application. Before you visit the registration page, use Keytool to generate the fingerprint of the appropriate certificate.

First, determine which key you will use to sign your application at release and make sure of the path to the keystore that contains it.

Next, run Keytool with the -list option, against the target keystore and key alias. The table below lists the options you should use.
Keytool Option Description
-list Print an MD5 fingerprint of a certificate.
-keystore <keystore-name>.keystore The name of the keystore containing the target key.
-storepass <password>

A password for the keystore.

As a security precaution, do not include this option in your command line unless you are working at a secure computer. If not supplied, Keytool prompts you to enter the password. In this way, your password is not stored in your shell history.
-alias <alias_name> The alias for the key for which to generate the MD5 certificate fingerprint.
-keypass <password>

The password for the key.

As a security precaution, do not include this option in your command line unless you are working at a secure computer. If not supplied, Keytool prompts you to enter the password. In this way, your password is not stored in your shell history.

Here''s an example of a Keytool command that generates an MD5 certificate fingerprint for the key alias_name in the keystore my-release-key.keystore:


keytool-列表-alias alias_name -keystore my-release-key.keystore

Keytool将提示您输入密钥库和密钥的密码.作为命令的输出,Keytool将指纹打印到外壳.例如:

证书指纹(MD5):94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98

拥有指纹后,您可以转到Maps API注册网站,如下所述.
获取SDK调试证书的MD5指纹

在开发和调试应用程序时,您可能会在调试模式下使用应用程序-即,SDK构建工具将使用调试证书自动对应用程序进行签名.为了让您的MapView元素在此期间正确显示Maps数据,您应该获得一个注册到调试证书的临时Maps API密钥.为此,您首先需要获取调试证书的MD5指纹.准备发布应用程序时,必须在Google Maps服务中注册发布证书,并获取新的Maps API密钥.然后,您必须在应用程序中更改MapView元素以引用新的API密钥.

要生成调试证书的MD5指纹,请首先找到调试密钥库.默认情况下,构建工具会在活动AVD目录中创建调试密钥库. AVD目录的位置因平台而异:

Windows Vista:C:\ Users \< user> \.android \ debug.keystore
Windows XP:C:\ Documents and Settings \< user> \.android \ debug.keystore
OS X和Linux:〜/.android/debug.keystore

如果您使用的是Eclipse/ADT,但不确定调试密钥库的位置,则可以选择Windows>.首选项Android>进行构建以检查完整路径,然后可以将其粘贴到文件资源管理器中以找到包含密钥库的目录.

找到密钥库后,请使用以下Keytool命令获取调试证书的MD5指纹:

keytool -list -alias alias_name -keystore my-release-key.keystore

Keytool will prompt you to enter passwords for the keystore and key. As output of the command, Keytool prints the fingerprint to the shell. For example:

Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98

Once you have the fingerprint, you can go to the Maps API registration site, described next.
Getting the MD5 Fingerprint of the SDK Debug Certificate

While you are developing and debugging your application, you will likely be sigining your application in debug mode — that is, the SDK build tools will automatically sign your application using the debug certificate. To let your MapView elements properly display Maps data during this period, you should obtain a temporary Maps API Key registered to the debug certificate. To do so, you first need to get the MD5 fingerprint of the debug certificate. When you are ready to release your application, you must register your release certificate with the Google Maps service and obtain a new Maps API Key. You must then change the MapView elements in your application to reference the new API key.

To generate an MD5 fingerprint of the debug certificate, first locate the debug keystore. By default, build tools create the debug keystore in the active AVD directory. The location of the AVD directories varies by platform:

Windows Vista: C:\Users\<user>\.android\debug.keystore
Windows XP: C:\Documents and Settings\<user>\.android\debug.keystore
OS X and Linux: ~/.android/debug.keystore

If you are using Eclipse/ADT and are unsure where the debug keystore is located, you can select Windows > Prefs > Android > Build to check the full path, which you can then paste into a file explorer to locate the directory containing the keystore.

Once you have located the keystore, use this Keytool command to get the MD5 fingerprint of the debug certificate:


keytool -list -alias androiddebugkey \
-keystore< path_to_debug_keystore> .keystore \
-storepass android -keypass android


使用JDK版本1.6而不是1.7,因为默认情况下1.7使用SHA1生成指纹.或者您可以使用keytool的(-v)选项为您提供所有受支持的算法输出,并且您会在其中找到MD5.对于示例:keytool -v -list -keystore [您的密钥库路径],然后输入默认为[android]的密码(您可以从Eclipse窗口> Prefs> Android> build中获取密钥库路径).
keytool -list -alias androiddebugkey \
-keystore <path_to_debug_keystore>.keystore \
-storepass android -keypass android


Use JDK version 1.6 instead of 1.7 because 1.7 generates the fingerprint with SHA1 by default. or you can use (-v) option of the keytool to give you all supported algorithms output and you will find the MD5 in it. for examble : keytool -v -list -keystore [your keystore path] and then enter the password which is [android] by default (you can get the keystore path from Eclipse window>Prefs>Android>build).


这篇关于与Google api连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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