"授权失败"开发Google地图应用时

时间:2018-05-12 15:33:11

标签: android google-maps

在我的笔记本电脑/ HTC安卓手机上尝试创建Google地图应用时,我遇到了一些问题。 我使用互联网上的示例创建了一个非常简单的示例程序,并且我已经在开发人员模式下设置了手机,并允许USB调试。我有一个启用的API密钥, 我看过GOTCHA!在此页Android: Google Maps Android API: Authorization failure

但是当我尝试在手机上调试并运行它时,我得到一个空白屏幕,在调试窗口中,我得到:

E/Google Maps Android API: Authorization failure.  Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
                       Ensure that the "Google Maps Android API v2" is enabled.
                       Ensure that the following Android Key exists:
                        API Key: ****
                        Android Application (<cert_fingerprint>;<package_name>): 82:D1:22:C3:3E:8E:02:9F:30:09:2C:2E:F7:15:13:90:C9:1F:32:F7;com.paullee.getest

有人可以帮忙吗?

2 个答案:

答案 0 :(得分:0)

映射实现需要来自google developer console的api密钥(如果使用restrict api密钥,还需要注册系统SHA1)。

你会做两件事:

  1. 为您的项目启用地图API
  2. 将SHA1指纹放入开发者控制台(如果使用受限制的api)
  3. 获取api密钥和SHA1

    的一些有用链接

    https://stackoverflow.com/a/33479550/6891563

    How to get google map apikey in android

答案 1 :(得分:0)

  1. 登录到您的Google Cloud Platform Console
  2. 点击左侧面板上的API
  3. 点击Android版Maps SDK并启用
  4. 单击凭据,然后选择您的API密钥
  5. 应用程序限制:选择Android应用程序
  6. 输入cert_fingerprint和package_name

完成