简体   繁体   English

Google Maps片段活动

[英]Google Maps fragment activity

I am really sorry to ask such a bland and stupid question, but I am having the greatest of frustrations with trying to load the Google Maps project library into my project resources. 我很遗憾地提出这样一个平淡而愚蠢的问题,但我在尝试将Google Maps项目库加载到我的项目资源中时遇到了最大的麻烦。

I have downloaded all the tools and necessities needed from the SDK to get Google Maps. 我已下载SDK中所需的所有工具和必需品以获取Google地图。

However, whenever I try to load the Google Maps library, I get 2 errors. 但是,每当我尝试加载Google地图库时,我都会遇到2个错误。

The first is that for some reason, 首先是出于某种原因,

the Class known as FragmentActivity is missing. 缺少称为FragmentActivity的类。 I have no idea what it is or where to find it to get things going with an Android project. 我不知道它是什么或在哪里找到它来使用Android项目。

The second distinct problem is that the console shoots off the following message: 第二个明显的问题是控制台发出以下消息:

"google_maps] Unable to resolve target 'android-16'" “google_maps”无法解析目标'android-16'“

Although I have a fairly strong idea of what this means, I don't quite know how to troubleshoot so that the library is built towards the desired API level. 虽然我对这意味着什么有一个相当强烈的想法,但我不太清楚如何进行故障排除,以便库建立在所需的API级别。

I do apologize as I am new to Android and absolutely love the platform, but this one really has me dumbfounded. 我很抱歉,因为我是Android新手并且非常喜欢这个平台,但是这个让我傻眼了。 Any and all information and suggestions is always most appreciated. 任何和所有信息和建议总是最受欢迎。

Thanks and once again, sorry for asking something so silly. 再次感谢,抱歉问一些如此愚蠢的事情。

Well for the first question: 那么第一个问题:

FragmentActivity is part of the google-support-v4 library and designed for application that are developed to SDK < 11 for supporting fragments. FragmentActivitygoogle-support-v4库的一部分,专为应用程序而设计,这些应用程序开发为SDK < 11以支持片段。 So you didn't added the referencing of this library to you project. 所以你没有在你的项目中添加这个库的引用。

you can get a better idea of the imports you need to make and how to make them by reading this blog post I wrote on Google Map API V2: 通过阅读我在Google Map API V2上写的博文,您可以更好地了解您需要进口的内容以及如何制作它们:

Google Map API V2 guide Google Map API V2指南

about your second question, you probably trying to run this project against an API level you didn't downloaded from the SDK Manager , you have two options: 关于您的第二个问题,您可能尝试针对未从SDK Manager下载的API级别运行此项目,您有两个选择:

  1. downloaded the needed API package from the SDK Manager . SDK Manager下载了所需的API包。

  2. right click on your project -> Properties -> Android -> change the project build target to a target that you have its API level downloaded. 右键单击您的项目 - >属性 - > Android - >将项目构建目标更改为您已下载其API级别的目标。

Try this answer, Generate Google Map key for android - step by step . 试试这个答案, 为Android生成Google Map键 - 一步一步

Or take a look to this very helpful step by step tutorial . 或者看看这个非常有用的一步一步的教程 I struggle for 3 days with the maps stuff, but that tutorial showed me the light. 我用地图的东西挣扎了3天,但那个教程向我展示了光明。

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

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