Android 生成谷歌地图发布 API 密钥
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10386770/
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
Generating Google map Release API Key
提问by stations essence
My app uses Google Maps, I signed up for a Google Maps key to debug, it worked. But now, I need a Google Maps key in release mode, before publishing. How can I get it?
我的应用程序使用谷歌地图,我注册了一个谷歌地图密钥进行调试,它有效。但是现在,在发布之前,我需要一个处于发布模式的 Google Maps 密钥。我怎么才能得到它?
采纳答案by Rapha?l Titol
You need to :
你需要 :
Create your own signing key that you will use for publishing, using Keytool : http://developer.android.com/guide/publishing/app-signing.html#cert
Get the MD5 fingerprint of your newly generated key : https://developers.google.com/maps/documentation/android/mapkey#getfingerprint
Submit the signature to this link to get your Google Maps key : https://developers.google.com/android/maps-api-signup?hl=fr
Export your application with your newly created key, in Eclipse : right click on your projet -> Android Tools -> Export signed application package.
使用 Keytool 创建您自己的用于发布的签名密钥:http: //developer.android.com/guide/publishing/app-signing.html#cert
获取新生成的密钥的 MD5 指纹:https: //developers.google.com/maps/documentation/android/mapkey#getfingerprint
将签名提交到此链接以获取您的 Google 地图密钥:https: //developers.google.com/android/maps-api-signup?hl=fr
在 Eclipse 中使用新创建的密钥导出您的应用程序:右键单击您的项目 -> Android 工具 -> 导出已签名的应用程序包。
Be careful to keep your certificate in a safe place, because you will need it if you want to publish an update of your app on Google Play.
请小心将您的证书保存在安全的地方,因为如果您想在 Google Play 上发布您的应用程序更新,您将需要它。
EDIT :
编辑 :
For the Google Maps Android V2, the signing is a little different. You will need to get the SHA-1 signature and provide the package name of your application as well. A Google APi account is moreover needed. All info are given on this page : https://developers.google.com/maps/documentation/android/start?hl=fr#the_google_maps_api_key
对于 Google Maps Android V2,签名有点不同。您需要获取 SHA-1 签名并提供应用程序的包名称。此外还需要一个 Google API 帐户。此页面上提供了所有信息:https: //developers.google.com/maps/documentation/android/start?hl=fr#the_google_maps_api_key
回答by Harshid
Before publishing applicationinto play store you have to follow some step to create release key.
在将应用程序发布到 Play 商店之前,您必须按照一些步骤来创建release key.
Step 1:First find your key store location. Ex. D:\Harshid\testKeystore
第 1 步:首先找到您的密钥存储位置。前任。D:\Harshid\testKeystore
Step 2:Run this command.
第 2 步:运行此命令。
keytool -list -v -keystore D:\Harshid\ testKeystore -alias D:\Harshid\ testKeystore
please used fully qualified name of keystore.
请使用密钥库的完全限定名称。
Step 3:Copy SHA1
第 3 步:复制 SHA1
Step 4:Follow thisgoogle map api console.
第 4 步:按照此操作google map api console.
回答by user2728731
C:\Users\admin\.android>keytool.exe -list -alias androiddebugkey -keystore "C:\U
sers\admin\.android\debug.keystore" -storepass android -keypass android
androiddebugkey, Oct 14, 2011, PrivateKeyEntry,
Certificate fingerprint (MD5): 67:0D:D0:72:C6:4C:C0:5B:68:AD:B5:BC:ED:AB:BE:DF
2012
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\admin>cd .android
C:\Users\admin\.android>keytool.exe -list -alias androiddebugkey -keystore "C:\U
sers\admin\.android\debug.keystore" -storepass android -keypass android
androiddebugkey, Jan 9, 2012, PrivateKeyEntry,
Certificate fingerprint (MD5): DC:31:3D:50:D1:74:27:DD:DE:7C:4D:D3:9E:FC:7E:4B
C:\Users\admin\.android>
10-March 2012
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0ogz8aFVENHYdrrUL1WWWZIcv06YYgtRT7zL-vA"
/>
C:\Program Files\Java\jdk1.6.0_20\bin>keytool.exe -list -keystore "C:\Users\adm
n\izeeka.keystore"
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
abc, Apr 5, 2012, PrivateKeyEntry,
Certificate fingerprint (MD5): A9:BA:68:1F:6B:30:8D:78:36:3F:AE:5F:BA:35:7A:EE
C:\Program Files\Java\jdk1.6.0_20\bin>keytool.exe -list -keystore "C:\Users\admi
n\.android\edtechconference.keystore"
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
abc, Sep 6, 2012, PrivateKeyEntry,
Certificate fingerprint (MD5): 8A:41:56:2F:64:80:6A:5C:5C:90:AF:E2:94:C4:D8:0A
Apikey:0ogz8aFVENHZSMYjvPgixpaCWH21Z2zEulRruDA
C:\Program Files\Java\jdk1.6.0_20\bin>keytool.exe -list -keystore "D:\google"
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
a, Jul 9, 2013, PrivateKeyEntry,
Certificate fingerprint (MD5): 74:0F:CA:7C:34:44:34:3E:52:74:EE:41:F8:FC:68:44
//SHA--1
C:\Program Files\Java\jdk1.6.0_20\bin>keytool.exe -exportcert -alias androiddebu
gkey -keystore "C:\Users\admin\.android\debug.keystore" -list -v
Enter keystore password:
Alias name: androiddebugkey
Creation date: Jul 17, 2012
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: 5004ffd3
Valid from: Tue Jul 17 11:31:55 IST 2012 until: Thu Jul 10 11:31:55 IST 2042
Certificate fingerprints:
MD5: 09:37:6A:CE:A7:14:17:B5:0E:24:05:BD:A8:BA:29:63
SHA1: 7A:EB:A6:D4:DA:04:7B:E6:09:C5:7F:C8:BA:2C:82:54:C7:99:1E:AF
Signature algorithm name: SHA1withRSA
Version: 3
_Mapapikey-----------------19/7/2013
C:\Program Files\Java\jdk1.6.0_20\bin>keytool.exe -list -alias androiddebugkey -
keystore "C:\Users\admin\.android\debug.keystore" -storepass android -keypass an
droid
androiddebugkey, Jul 17, 2012, PrivateKeyEntry,
Certificate fingerprint (MD5): 09:37:6A:CE:A7:14:17:B5:0E:24:05:BD:A8:BA:29:63
回答by Uncaught Exception
Debug key will not work for the release build. Pls go through the info mentioned about generating key in this official page. Moreover, you can add the SHA1 for both your release and debug build, if you want to use a single key for both debugging and release purposes.
调试键不适用于发布版本。请仔细阅读此官方页面中提到的有关生成密钥的信息。此外,如果您想将单个密钥用于调试和发布目的,您可以为发布和调试版本添加 SHA1。
回答by Milind
i hope u know that The Android build process signs your application differently depending on which build mode you use to build your application. There are two build modes: debug mode and release mode. You use debug mode when you are developing and testing your application.
我希望您知道 Android 构建过程会根据您用于构建应用程序的构建模式对您的应用程序进行不同的签名。有两种构建模式:调试模式和发布模式。您在开发和测试应用程序时使用调试模式。
The debug signing process happens automatically when you run or debug your application using Eclipse with the ADT plugin
当您使用带有 ADT 插件的 Eclipse 运行或调试应用程序时,调试签名过程会自动发生
- For Release mode-
- 对于发布模式-
if you are using Eclipse with the ADT plugin, you can use the Export Wizard to export a signed APK (and even create a new keystore, if necessary). The Export Wizard performs all the interaction with the Keytool and Jarsigner for you, which allows you to sign the package using a GUI instead of performing the manual procedures to compile, sign, and align, as discussed above. Once the wizard has compiled and signed your package, it will also perfom package alignment with zipalign. Because the Export Wizard uses both Keytool and Jarsigner, you should ensure that they are accessible on your computer, as described above in the Basic Setup for Signing.
如果您使用带有 ADT 插件的 Eclipse,您可以使用导出向导导出已签名的 APK(如果需要,甚至可以创建新的密钥库)。导出向导为您执行与 Keytool 和 Jarsigner 的所有交互,这允许您使用 GUI 对包进行签名,而不是执行手动程序来编译、签名和对齐,如上所述。一旦向导编译并签署了您的包,它还会使用 zipalign 执行包对齐。因为导出向导同时使用 Keytool 和 Jarsigner,所以您应该确保它们可以在您的计算机上访问,如上面签名的基本设置中所述。
To create a signed and aligned APK in Eclipse:
Select the project in the Package Explorer and select File > Export. Open the Android folder, select Export Android Application, and click Next.
The Export Android Application wizard now starts, which will guide you through the process of signing your application, including
steps for selecting the private key with which to sign the APK (or
creating a new keystore and private key).Complete the Export Wizard and your application will be compiled, signed, aligned, and ready for distribution.
要在 Eclipse 中创建签名和对齐的 APK:
在 Package Explorer 中选择项目,然后选择 File > Export。打开 Android 文件夹,选择导出 Android 应用程序,然后单击下一步。
导出 Android 应用程序向导现在启动,它将指导您完成应用程序签名过程,包括
选择用于签署 APK 的私钥(或
创建新的密钥库和私钥)的步骤。完成导出向导,您的应用程序将被编译、签名、对齐并准备好分发。
回答by Yagnesh bhalala
If you cannot generate api key then you can use my key as given define.
1]key=AIzaSyCeBdq7rr-R7w7vZCXscLWgEDb3oO9CUhw
2]key=AIzaSyCc7FZQ6jG2VcxnxbMNdkPFFzrUsJxq-ys
3]key=AIzaSyBQuNDY3fycSayPzaE7lzMDxZqMSOKF8AA
4]key=AIzaSyDJ7rKNS4BjfM8qfsY6oJzsYvXGkQV8hTo
5]key=AIzaSyDFasJ3EgYe3HCfjyLLVM1DMaQjD7cgWpk&v=3.exp&libraries=places
--This is special for version 3--
If above define all key are working. Hope this key is useful for you