简体   繁体   English

Android Google地图应用程序显示灰色背景而不是地图

[英]Android Google Maps application showing grey background instead of the map

OK, I'm having the weirdest bug right now : the Android application I'm working on is displaying a grey background instead of the map, such as below : 好吧,我现在有一个最奇怪的错误:我正在处理的Android应用程序显示灰色背景而不是地图,如下所示:

WTF
(source: hostingpics.net ) (来源: hostingpics.net

Here's the logcat : 这是logcat:

04-25 15:08:42.082: E/Google Maps Android API(19139): Failed to load map.  Could not contact Google servers.
04-25 15:08:42.082: W/Google Maps Android API(19139): Please add <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> into AndroidManifest.xml to ensure correct behavior under poor connectivity conditions.

I have NO idea what might have caused this. 我不知道是什么原因引起的。 I only changed a small part of my code that was completely unrelated to the map. 我只更改了与地图完全无关的代码的一小部分。 And besides, I tried reverting the changes I made, and it still didn't work. 此外,我尝试恢复我所做的更改,但仍然无法正常工作。 I tried adding the line the logcat gave me, changing the API key, re-installing the Google Play library, deleting the previous versions of my app on my tablet, basically pretty much everything that I read on the Internet. 我尝试添加logcat给我的行,更改API密钥,重新安装Google Play库,删除我平板电脑上以前版本的应用程序,基本上是我在互联网上阅读的所有内容。 Still doesn't work. 仍然无法正常工作。

If anyone has any idea what the problem might be, that would be great. 如果有人知道问题可能是什么,那就太好了。

This problem is caused when there is a problem with your key or a problem with it's configuration in the Google API Console. 当您的密钥出现问题或Google API控制台中的配置出现问题时,会导致此问题。

Go over this blog post I wrote on how to produce the key and integrate in in the console: 回顾一下这篇关于如何生成密钥并在控制台中集成的博客文章:

Google Maps API V2 key Google Maps API V2密钥

if this is not helpful you can try to delete the dubug.keystore folder in you user folder, compile some project in eclipe (which result in regenerating this key) and try to register it again. 如果这没有帮助,您可以尝试删除用户文件夹中的dubug.keystore文件夹,在dubug.keystore中编译一些项目(这会导致重新生成此密钥)并尝试再次注册它。

UPDATE: From the new error you posted, do you have this permission in your manifest file: 更新:从您发布的新错误中,您是否在清单文件中拥有此权限:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

试试这个:将“Custom debug keystore”设置( empty by defaultempty by default )设置为与Eclipse首选项中的“Default debug keystore”相同的值。

Emil's post above helped me, I was getting the same error and realised that this was due to me changing the name of my project. 上面的Emil的帖子对我有帮助,我得到了同样的错误,并意识到这是由于我改变了我的项目名称。 I added the changed name along with the same SHA1 I had for my old project on a new line (leaving the one with the old name above) in the console and it seemed to work as normal. 我在控制台中添加了更改后的名称以及我在旧线上的旧项目所使用的SHA1(在上面留下了旧名称),它似乎正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM