【发布时间】:2019-10-10 11:36:27
【问题描述】:
我收到此错误:
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: [The key...]
Android Application (<cert_fingerprint>;<package_name>):
我看到的不是地图正常工作,而是:
在我的app/build.gradle,我有这个:
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.android.gms:play-services-awareness:16.0.0'
implementation 'com.google.android.gms:play-services-cast:16.2.0'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
play-services-location 是我需要的 Google 地图,对吗?我正在查看https://developers.google.com/android/guides/setup 的列表,我认为Google Location and Activity Recognition - com.google.android.gms:play-services-location:16.0.0 是我需要Google Maps 的。这是正确的吗?
更新 1:我已经启用了 Maps SDK for Android:
错误提示:Ensure that the "Google Maps Android API v2" is enabled.。是否指的是我在此 UPDATE 1 的屏幕截图中显示的 Maps SDK for Android?
更新 2:我已启用 Maps SDK for Android:
当我点击MANAGE 按钮时,我可以转到配置我在UPDATE 1 中显示的凭据的部分。
更新 3: 我看到地图在模拟器的所有 Android 版本上都正确显示。但是在物理设备上,地图永远不会出现。我看到了 Google 徽标和红色气球,但现在当我在实体手机上运行应用程序时看到的是地图。只有在模拟器上一切正常。任何想法为什么?
更新 4: 请参阅我的解决方案 https://stackoverflow.com/a/56307654/4242086。
【问题讨论】:
标签: google-maps google-maps-api-3 google-play-services google-maps-android-api-2 google-maps-android-api-1