简体   繁体   English

Android Studio - Google Maps API 适用于调试版本,但不适用于发布版本

[英]Android Studio - Google Maps API works for debug version but not for release version

I've built an app that contains a Map from Google Maps API.我构建了一个包含来自 Google Maps API 的地图的应用程序。 When I was trying it, and debugging directly from Android Studio, all worked fine Now I released the app, and in the release version, the map is not displayed anymore, only the location-button is displayed.当我尝试它并直接从 Android Studio 调试时,一切正常 现在我发布了应用程序,并且在发布版本中,不再显示地图,只显示位置按钮。

Do I need a new google maps api key for the release version in \\app\\src\\release\\res\\values\\google_maps_api and if I do so, how do I get the right key?我是否需要在\\app\\src\\release\\res\\values\\google_maps_api为发布版本使用新的 google maps api 密钥,如果需要,我如何获得正确的密钥?

Or is there another problem with the release version?还是发布版本有其他问题?

You need to Release key for your application :您需要为您的应用程序释放密钥:

  1. Create your own signing key that you will use for publishing, using Keytool : http://developer.android.com/guide/publishing/app-signing.html#cert使用 Keytool 创建您自己的用于发布的签名密钥: http : //developer.android.com/guide/publishing/app-signing.html#cert

  2. Get the MD5 fingerprint of your newly generated key : https://developers.google.com/maps/documentation/android/mapkey#getfingerprint获取新生成的密钥的 MD5 指纹: https : //developers.google.com/maps/documentation/android/mapkey#getfingerprint

  3. Submit the signature to this link to get your Google Maps key : https://developers.google.com/android/maps-api-signup?hl=fr将签名提交到此链接以获取您的 Google 地图密钥: https : //developers.google.com/android/maps-api-signup?hl=fr

  4. Export your application with your newly created key, in Eclipse : right click on your projet -> Android Tools -> Export signed application package.在 Eclipse 中使用新创建的密钥导出您的应用程序:右键单击您的项目 -> Android 工具 -> 导出已签名的应用程序包。

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 上发布您的应用程序的更新,您将需要它。

If you use App Signing by Google Play( https://support.google.com/googleplay/android-developer/answer/7384423 )如果您使用 Google Play 应用签名( https://support.google.com/googleplay/android-developer/answer/7384423 )

You need another API KEY Application restrictions : not from your debug, release keystore, but form Google Play Console -> Release management -> App signing -> App signing certificate -> SHA-1 certificate fingerprint.您需要另一个 API KEY 应用程序限制:不是来自您的调试、发布密钥库,而是来自 Google Play 控制台 -> 发布管理 -> 应用签名 -> 应用签名证书 -> SHA-1 证书指纹。

Good Luck.祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM