【问题标题】:MapActivity cannot be resolved to a typeMapActivity 无法解析为类型
【发布时间】:2011-11-15 21:25:03
【问题描述】:

我正忙于将 MapView 包含在我的 Android 项目中。我正在关注 Android 开发者网站上的 MapView 教程,但出现错误:

'MapActivity cannot be resolved to a type'

我尝试按 Ctrl+Shift+O 自动导入所有类,但没有帮助。当我尝试手动包含地图库时,会出现此错误:

'The import com.google.android cannot be resolved'

我在 Manifest 中添加了以下行(见下文),我的目标是 API 7(平台:2.1)。

<uses-library android:name="com.google.android.maps" />

我做错了什么?

谢谢!!!

【问题讨论】:

  • 您的项目构建目标是否设置为 Google API?
  • 感谢您的评论。我已经使用 Android SDK Manager 来获取所有包。我已经安装了所有可用的软件包,毕竟 Google API 的构建目标仍然不在列表中?我有所有的 Android 包(1.5 到 4.0)。
  • 您使用的是eclipse,对吗?尝试转到 Window>Android SDK and ADK Manager>Installed Packages,然后确保它们是最新的。
  • 我已经安装了所有的软件包并且它们都是最新的,但是 Google API 仍然没有出现。

标签: android google-maps android-mapview


【解决方案1】:

您需要在编译时引用正确的库。但是您所描述的是要求 Android 在运行时使用这个特定的库。

您需要右键单击您的 Eclipse 项目,属性 -> Android。在 Project Build Target 中选择供应商 Google Inc. 的任何目标。

【讨论】:

    【解决方案2】:

    Google API 是第三方 SDK。在包管理器中选择第三方。

    【讨论】:

    猜你喜欢
    • 2011-04-06
    • 2012-01-18
    • 2015-10-22
    • 1970-01-01
    • 2021-08-28
    • 2013-12-14
    • 2015-06-10
    • 2015-11-22
    • 1970-01-01
    相关资源
    最近更新 更多