Google地图不显示/空白

编程入门 行业动态 更新时间:2024-10-26 06:36:17
本文介绍了Google地图不显示/空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我发现了这个不同的话题,但都没有让我看到在我的活动中工作的地图。 我遵循了google提供的有关使用Google Play服务中的地图的指南:

  • 我已下载并添加到我的图书馆Google Play服务
  • 我已经根据服务>地图活动模板创建了一项新活动
  • google_maps_api.xml到的指令获取api键
  • 在我的设备上构建并运行应用程序
  • 实现了我错过了一些我已经从清单中的其他线程中添加权限 $ b

    <?xml version =1.0encoding =utf-8?>< manifest xmlns:android =schemas.android/apk/res/androidpackage =net.labinfo.hotels.core> < uses-permission android:name =android.permission.INTERNET/> < uses-permission android:name =android.permission.ACCESS_NETWORK_STATE/> < uses-permission android:name =android.permission.ACCESS_WIFI_STATE/> < uses-permission android:name =android.permission.VIBRATE/> < uses-permission android:name =android.permission.ACCESS_FINE_LOCATION/> < uses-permission android:name =android.permission.ACCESS_COARSE_LOCATION/> < uses-permission android:name =android.permission.WRITE_EXTERNAL_STORAGE/> < uses-permission android:name =com.google.android.c2dm.permission.RECEIVE/> < uses-permission android:name =net.labinfo.hotels.core.permission.MAPS_RECEIVE/> <! - GCM需要一个Google帐户。 - > < uses-permission android:name =android.permission.GET_ACCOUNTS/> < uses-permission android:name =net.labinfo.hotels.core.permission.C2D_MESSAGE/> <! - 收到消息时使处理器保持休眠状态。 - > < uses-permission android:name =android.permission.WAKE_LOCK/> < uses-permission android:name =com.google.android.providers.gsf.permission.READ_GSERVICES/> < application android:allowBackup =trueandroid:largeHeap =trueandroid:theme =@ style / AppTheme> < meta-data android:name =com.google.android.gms.analytics.globalConfigResourceandroid:resource =@ xml / global_tracker/> .....< / activity> < activity android:name =。components.activities.avis.AvisMappaActivityandroid:label =@ string / title_activity_avis_mappa> < /活性GT; < uses-library android:name =com.google.android.maps/> < meta-data android:name =com.google.android.maps.v2.API_KEYandroid:value =@ string / google_maps_key/> < / application>< / manifest>

    是只显示角落里的谷歌徽标的活动,没有logcat错误或通知的迹象。 我错过了什么吗?我看到在api键的谷歌控制台生成过程中,它向我展示了一个SHA键,但我从来没有使用它。

    希望有人能帮助我这

    解决方案

    我解决了它。正如你们所有人都建议这是API密钥,特别是与该密钥相关的许可。

    我的问题是软件包名称,因为我使用了一个具有不同模块的应用程序,发送到服务器的包名称与用于自动创建密钥的包名称不同。所以我解决了这个问题,增加了使用相同SHA1键的另一个软件包名称的权限。

    对于所有未来的读者,我希望您注意到我拥有没有错误显示,直到我从SupportMapFragment切换到MapFragment,所以我建议这样做进行调试。

    感谢任何人的帮助,欢呼。

    I've found different topic about this, but neither got me the maps working in my activity. I've followed the guide provided by google about using maps from google play service:

  • I've download and added to my libraries google play services
  • I've created a new activity based on the Service > Map Activity template
  • I've followed the instructions in google_maps_api.xml to get the api key
  • Built and run the application on my device
  • Realized I missed something I've added permissions suggested from other threads in the manifest
  • <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="schemas.android/apk/res/android" package="net.labinfo.hotels.core" > <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="net.labinfo.hotels.core.permission.MAPS_RECEIVE"/> <!-- GCM requires a Google account. --> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="net.labinfo.hotels.core.permission.C2D_MESSAGE" /> <!-- Keeps the processor from sleeping when a message is received. --> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <application android:allowBackup="true" android:largeHeap="true" android:theme="@style/AppTheme" > <meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/global_tracker" /> ..... </activity> <activity android:name="ponents.activities.avis.AvisMappaActivity" android:label="@string/title_activity_avis_mappa" > </activity> <uses-library android:name="com.google.android.maps"/> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/google_maps_key" /> </application> </manifest>

    Still the result is the activity showing only the google logo in the corner and no sign of errors or notifications from logcat. Am I missing something? I saw that during the google console generation of the api key it showed to me a SHA key, but I've never used it.

    Hope somebody can help me out about this

    解决方案

    I've solved it. As all of you suggested it was the API key, in particular permissions related to that key.

    My problem was the package name, since I used an app with different module, the package name sent to the server was different than the one used to create the key automatically. So I've fixed the problem adding to permission another package name with the same SHA1 key.

    For all future readers, I want you to note that I had no error shown until I switched from SupportMapFragment to MapFragment, so I suggest to do so for debugging.

    Thanks to anyone helping, cheers.

    更多推荐

    Google地图不显示/空白

    本文发布于:2023-06-07 22:04:39,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:空白   地图   Google

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!