Google Maps API Key in release build doesn#39;t work(发布版本中的 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 密钥不起作用


- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01