Android 错误 - 无法解析导入 com.google

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2535953/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:13:24  来源:igfitidea点击:

Error - The import com.google can not be resolved

android

提问by saran

I am new to android development. I got an error when I wrote the code

我是安卓开发的新手。我写代码时出错

import com.google.android.maps.MapView; 

in eclipse. The error is The import com.google can not be resolved.

在日食。错误是The import com.google can not be resolved.

Please anybody give suggestion to fix this problem.

请任何人提出解决此问题的建议。

回答by Jim Blackler

Bring up your project properties, and go to Android. Do you have an Android target selected that includes the Google APIs? Perhaps you just have a generic Android target.

调出您的项目属性,然后转到 Android。您是否选择了包含 Google API 的 Android 目标?也许您只有一个通用的 Android 目标。

回答by Nipun

As Jim said, you have to select "Google APIs" (which is Android x.x + Google APIs) instead of something like "Android 2.2" in your project's properties.

正如吉姆所说,您必须在项目的属性中选择“Google APIs”(即 Android xx + Google APIs)而不是“Android 2.2”之类的东西。

回答by agiles

First you have to make sure you have installed Google API

首先你必须确保你已经安装了 Google API

Then set your project's properties in Eclipse to check off the Google APIs version of the SDK.

然后在 Eclipse 中设置项目的属性以检查 SDK 的 Google API 版本。

and Make sure you have include this library in AndroidManifest FIle

并确保您已在 AndroidManifest 文件中包含此库

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