Google Maps API(9757):授权失败

时间:2018-06-26 15:07:09

标签: android google-maps

Android Studio 3.1.3
Android 6.0
摇篮4.4

我想获取新的Google Map api密钥。所以这是我的步骤:

  1. 在Android Studio中的android项目中,我打开文件:“ googel_maps_api.xml”

  2. 将下一个网址复制到剪贴板:

    https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=90:32:34:28:BE:CC:5D:04:E3:99:43:xx:97:xxx30:42:82:3A:66:CF%3Bcom.myprojectcustomer.debug

  3. 在Google控制台中,我选择我的项目,然后单击按钮

enter image description here

  1. 单击按钮以创建新的密钥api enter image description here

这里结果 enter image description here

  1. 在字段 google_maps_key

  2. 中的文件“ googel_maps_api.xml”中复制生成的密钥
  3. 在清单文件中添加元数据 android:name =“ com.google.android.geo.API_KEY”

  4. 我在这里使用的Google api:

enter image description here

  1. 重新启动我的android应用

  2. 但是在logcat上我得到了错误:

        E/Google Maps Android API( 9757): 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( 9757): In the Google Developer Console (https://console.developers.google.com)
        E/Google Maps Android API( 9757): Ensure that the "Google Maps Android API v2" is enabled.
        E/Google Maps Android API( 9757): Ensure that the following Android Key exists:
        E/Google Maps Android API( 9757):   API Key: AIzaSyCTvKejzCdZxxxxxxxxxxSIPG9DkegNss4-VJ8fjVt4
        E/Google Maps Android API( 9757):   Android Application (<cert_fingerprint>;<package_name>): B7:CE:53:19:C4:xx:Bxx2C:C6:51:35:AD:32:47:1E:53:6B:1A:0D:B9;com.myprojectcustomer.debug
    

结果,该地图没有显示。

1 个答案:

答案 0 :(得分:3)

检查并确保已为Google API控制台中的特定项目启用了Android Maps SDK。还要在您的Google API控制台中查看“应用程序限制”以获取该特定密钥。如果您选择了“ Android应用”,则程序包名称和SHA-1指纹必须与您的Android项目的程序包名称和google_maps_api.xml文件中生成的SHA-1指纹相匹配。您还可以在“应用程序限制”中选择“无”,只需将正确的API密钥放在google_maps_api.xml文件中即可。

相关问题