Google Map Android API V2中API Key的生成

1、找到debug.keystore的路径,我的路径是:/Users/jsntghf/.android/debug.keystore

 

点击菜单中的ADT,选择Preferences,在弹出的窗口中,左侧选择Build,右侧的Default debug keystore即为debug.keystore的路径

 

2、执行以下命令

 

MacBook-Pro:~ jsntghf$ cd .android/
MacBook-Pro:.android jsntghf$ keytool -list -v -keystore "/Users/jsntghf/.android/debug.keystore" -alias androiddebugkey -storepass android -keypass android
Alias name: androiddebugkey
Creation date: Mar 8, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 5139ee1f
Valid from: Fri Mar 08 21:56:47 CST 2013 until: Sun Mar 01 21:56:47 CST 2043
Certificate fingerprints:
	 MD5:  85:0E:BB:64:21:40:21:7A:4A:E9:31:D2:E3:B1:0D:3F
	 SHA1: 42:75:C5:2D:2E:6B:6E:B2:7B:79:7F:92:85:55:06:84:C8:27:68:F2
	 Signature algorithm name: SHA1withRSA
	 Version: 3

 

3、在Google APIs Console上创建API Project

 

打开https://code.google.com/apis/console/,用Gmail的账户登录,默认会创建一个名为API Project的项目。

点击左边的Services,会看到很多的Service,找到Google Maps Android API v2,然后将它设置成ON

 

4、获得API Key

 

点击左边的API Access,在出来的页面中点击Create new Android Key...,然后在对话框中填入SHA1;package name(SHA1即为步骤2中的42:75:C5:2D:2E:6B:6E:B2:7B:79:7F:92:85:55:06:84:C8:27:68:F2,package name即为AndroidManifest.xml中的package),例如:42:75:C5:2D:2E:6B:6E:B2:7B:79:7F:92:85:55:06:84:C8:27:68:F2;com.example.demo,点击Create即可获得以下输出:

 

Key for Android apps (with certificates)
API key:	
AIzaSyAhyvAAt3rdR8ATIH2VKlLzjhb9ICDy3UM
Android apps:	
42:75:C5:2D:2E:6B:6E:B2:7B:79:7F:92:85:55:06:84:C8:27:68:F2;com.example.demo
Activated on:	May 26, 2013 6:14 AM
Activated by:	 [email protected] – you

 

这里的AIzaSyAhyvAAt3rdR8ATIH2VKlLzjhb9ICDy3UM即为应用中需要用到的API Key。

你可能感兴趣的:(android,google map,v2)