发布版本中的 Google Maps API 密钥不起作用

Google Maps API Key in release build doesn#39;t work(发布版本中的 Google Maps API 密钥不起作用)

本文介绍了发布版本中的 Google Maps API 密钥不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发适用于 Android 的应用程序,并且正在使用 Google Maps API.在开发者控制台中,我添加了我的 SHA1 证书打印,然后是我的包名称.即使我使用 keytool 打印了这个 SHA1 证书,我也无法访问地图.我进行了大量搜索,但每个主题都让我找到了在开发人员控制台中错误的 API 密钥中出现错误的答案.但我选择了正确的 SHA1,我的证书之一.

I'm currently developing an application for Android and I'm using Google Maps API. In developer console, I added my SHA1 certificate print, followed by my package name. Even though I put this SHA1 certificate print using keytool, I can't access to the maps. I made lots of search, but every topics brought me to answers where error were in a wrong API Key in developer console. But I took the right SHA1, the one of my certificate.

提前致谢!

推荐答案

我也遇到了同样的问题,非常沮丧.我最终做的是使用我的发布密钥库制作的密钥并将其放入谷歌开发者控制台.然后,将以下内容添加到 android 清单中.

I had this same problem, it was super frustrating. What I ended up doing was taking the key I made using my release keystore and putting it in the google developers console. Then, added the following into the android manifest.

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="KEY GOES HERE"/>

我确定您已阅读相关文档,但请确保您完全按照发布证书的说明进行操作.

I'm sure you read the documentation on this, but make sure you follow the instructions for the release certificate to the dot.

https://developers.google.com/maps/documentation/android/signup

您也可以点击 google_maps_api.xml 文件中为您生成的链接.这会自动将密钥输入开发人员控制台的过程.但是,请确保您仍将元数据值添加到清单中.

You could also follow the link that was generated for you in the google_maps_api.xml file. This automates the process of entering the key into the developer console. However, make sure you still add that meta data value into your manifest.

这篇关于发布版本中的 Google Maps API 密钥不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:发布版本中的 Google Maps API 密钥不起作用