【问题标题】:Google Maps blank in Android [duplicate]Android中的Google Maps空白[重复]
【发布时间】:2018-01-17 11:45:48
【问题描述】:

我使用 maps api 在我的 Android 应用程序中集成了 Google Maps,但是当我启动它时它保持空白并且还显示 Google 徽标(见图)。 this is what the app shows

In builde app gradle I have:
dependencies{
implementation 'com.google.android.gms:play-services-maps:11.0.4'
}
apply plugin: 'com.google.gms.google-services'

在 manifest.xml 我有:

<uses-permission android:name="com.vallabh.googlemapspractice.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="The Api Key which I got from google console" />

【问题讨论】:

  • 查看logcat,是否有错误信息等;比如无效的apikey
  • 你看过3284172145550412吗?您的 API 密钥是否已启用,您是否可以在您的 Google Cloud Platform 信息中心看到该 API 的任何流量命中?
  • 首先你应该关注最新的文档......我确信当你使用 gradle 的 google-service 插件 时,不需要 "com.google.android.geo.API_KEY" 。 ..但你必须检查真正需要什么(如何设置)
  • 我通过重新安装 Android Studio 解决了这个问题。

标签: android google-maps google-play-services google-maps-android-api-2


【解决方案1】:

如果你使用android studio试试这个,很容易解决问题 这里android studio自动做了很多步骤。

创建新的谷歌地图活动

  • 文件 -> 新建 -> Google -> Google 地图活动。

找到 google_maps_api.xml 文件

按照 TODO 步骤运行应用程序之前,您需要一个 Google Maps API 密钥。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-12
    • 1970-01-01
    • 1970-01-01
    • 2020-08-04
    • 1970-01-01
    • 1970-01-01
    • 2018-06-04
    • 2019-10-18
    相关资源
    最近更新 更多