Android“你好,MapView”教程 - 地图图块无法加载

发布于 2024-08-12 21:40:16 字数 479 浏览 5 评论 0原文

我是 Android 软件开发新手,也是这个网站的新手。我希望有人对我遇到的问题有一些经验。

我一直在按照 Hello,MapView 教程 的顺序进行操作不仅要学习Android框架,还要学习Google Maps库。我已尽力完全按照教程的指示来实现。我的问题是应用程序确实在我的模拟器中加载(甚至在我的手机上),但地图图块没有加载。

通过 Google 搜索,我发现另一个网站上其他人的帖子也有同样的问题,但他/她的问题是添加到 AndroidManifest.xml 文件中的重要元素的顺序不正确。我仔细检查了我的这一点,但一切似乎都是正确的。

所以,我不确定问题是什么,并希望其他人之前已经看到过这一点。如果有帮助的话,我可以提供任何代码片段。

谢谢。

I am new to Android software development and new to this site. I am hoping someone might have some experience with the problem I am having.

I've been following the Hello, MapView tutorial in order to not only learn the Android framework, but also the Google Maps library. I've tried my best to implement things exactly as the tutorial has instructed. My problem is that the application does load in my emulator (or even on my phone for that matter), but the map tiles do not load.

Searching Google I found a post by someone else on another site having the same issue, but his/her problem was that the important elements added to the AndroidManifest.xml file were not in the right order. I double-checked this in mine, but everything seems to be right.

So, I am not sure what the issue is and was hoping others have seen this before. I can provide any snippets of code, if that would help.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

清欢 2024-08-19 21:40:17

我也遇到了瓷砖无法加载的问题。正如您在原始帖子中提到的,一种可能性是 AndroidManifest.xml 文件中元素的排序。 有一行:

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

具体来说,我最初在应用程序元素后面 。一旦我将此行移到应用程序元素之前,我的地图图块就会再次开始加载。

I had the issue of tiles not loading as well. As you mentioned your original post, one possibility is with the ordering of elements in the AndroidManifest.xml file. Specifically, I originally had the line:

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

after the application element. Once I moved this line before the application element, my map tiles started loading again.

多情出卖 2024-08-19 21:40:17

我认为,未加载的图块几乎总是由于使用了不准确的 API 密钥而导致的。你检查过你的吗?

详细信息:获取 Maps API 密钥< /a>

The tiles not loading is almost always a result of using an inaccurate API-key, i think. Have you checked yours?

Details: Obtaining a Maps API key

负佳期 2024-08-19 21:40:17

我遇到了同样的问题...我的错误是在清单文件中将 INTERNET 权限放入应用程序中。将其移出(向上)后,一切都运转良好。

I had the same problem... my error was in the manifest file puting INTERNET permissions inside application. After moveing it out (upside) everying was working good.

吃兔兔 2024-08-19 21:40:17

确保顶部面板上有 3g。如果不这样做,则没有互联网连接。有时我必须打开和关闭模拟器几次才能启动 3g。

Make sure you have 3g on the top panel. If you don't then there is no internet connection. Sometimes I have to turn the emulator on and off a couple of times to get 3g to come up.

删除会话 2024-08-19 21:40:17

d.可能是正确的。然而,互联网问题也会导致类似的症状。确保您的 INTERNET 权限设置正确,并且没有代理服务器/防火墙阻碍对 Internet 的访问。

d. is probably correct. However, Internet problems will also cause similar symptoms. Be sure that your INTERNET permission is properly positioned and that there are no proxy servers/firewalls impeding access to the Internet.

花开柳相依 2024-08-19 21:40:17

另一个问题可能是您背后的代理。代理会大大减慢速度,即使模拟器中的地图应用程序和互联网浏览器工作正常,它也会影响您的应用程序。

Another problem could be a proxy that you are behind. The proxy slows things down a lot and it will effect your app even though the maps app and internet browser in the emulator work fine.

眼趣 2024-08-19 21:40:17

这是一个老问题了,但这里还有一个答案:如果你像我一样仓促,你可能会不小心从网页上复制指纹代码而不是 API 密钥:)

This is old question, but here is one more answer: if you are as hasty as me, you might accidentally copy the finger print code instead of API key from the web page :)

挽容 2024-08-19 21:40:17

您所说的“Hello,MapView”教程不再有效。新的V1地图应用不能再做。

请关注https://developers.google.com/maps/documentation/android/ Google 地图 Android API v2 应用程序。

The Hello, MapView tutorial your were talking about is no longer valid. New V1 map applications can no longer be done.

Follow https://developers.google.com/maps/documentation/android/ for Google Maps Android API v2 applications.

旧人九事 2024-08-19 21:40:16

无法加载图块通常是由于未正确设置 API 密钥造成的。 获取 Maps API 密钥

要回答您留给 d. 的响应:如果您想让它在从 Eclipse 运行时“正常工作”,您需要获取调试证书的 API 密钥。 同一页面上有说明< /a> 和以前一样。请注意,在发布之前您必须换回其他密钥。

Non-loading tiles are usually the result of not having the API key set up correctly. Obtaining a Maps API key

To answer the response you left to d.: If you want to have it "just work" when you run from Eclipse you'll need to get an API key for your debug certificate. There's instructions on the same page as before. Do note that you'll have to swap back to your other key before publishing though.

下雨或天晴 2024-08-19 21:40:16

我猜问题不是您的映射密钥不正确,而是您没有正确的密钥库设置。该应用程序需要由您用于生成映射密钥的同一密钥库进行签名。您已经注意到,当您自己签署应用程序时,您可以让它工作,但是您需要设置一个调试密钥库,以便在常规 Eclipse 构建中使用 Maps API。

所有 Eclipse 构建都需要调试密钥库;您通常不会注意到它,因为 ADT 会自动为您生成一个。您应该按照此处的说明并创建您自己的调试密钥库,或者您应该获取 ADT 自动为您创建的调试密钥(它将显示在 Windows > 首选项 > Android > 构建 中创建它的位置)并注册另一个 Maps API钥匙。该密钥适用于 Eclipse。

(PS,这确实使编译发布变得很麻烦,因为您需要根据签名密钥库来回切换密钥。)

I am guessing the issue is not that you have an incorrect map key, but that you do not have the proper keystore setup. The application needs to be signed by the same keystore you used to generate the map key. You've noted that you can get it to work when you sign the application yourself, but you need to setup a debug keystore in order to use the Maps API with regular Eclipse builds.

All Eclipse builds require a debug keystore; you just normally don't notice it because ADT generates one for you automatically. You should either follow the directions here and create your own debug keystore, or you should take the debug key that ADT automatically created for you (it'll show you where it created it in Windows > Preferences > Android > Build) and sign up for another Maps API key. That key will work with Eclipse.

(P.S., this does make it a hassle to compile for release, as you need to switch your key back and forth depending on the signing keystore.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文