Eclipse 无法识别任何导入

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8826563/
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-09-19 17:33:38  来源:igfitidea点击:

Eclipse not Recognizing any imports

androideclipseimportandroid-mapview

提问by Aneem

I seem to have botched up something in Eclipse. It isn't recognizing any of the libraries that I am trying to import.

我似乎在 Eclipse 中搞砸了一些东西。它无法识别我尝试导入的任何库。

Here are some of the things not being recognized:

以下是一些不被认可的事情:

import java.util.ArrayList;
import android.content.Intent;
import com.google.android.maps.MapView;

This is a open source project that I downloaded and then imported into Eclipse. I think I also downloaded the google apis the wrong way because things like MapView don't work in my other projects as well. Can someone please help me out?

这是我下载然后导入 Eclipse 的开源项目。我想我也以错误的方式下载了 google api,因为像 MapView 这样的东西在我的其他项目中也不起作用。有人可以帮我吗?

Best,

最好的事物,

Aneem

阿尼姆

EDIT:

编辑:

Fixed, most of the issues. Did it by hovering mouse to import line and clicking "Fix project setup..."

已修复,大部分问题。通过将鼠标悬停以导入行并单击“修复项目设置...”来完成

Now the only thing I have to do is get the google map related API to work.

现在我唯一要做的就是让谷歌地图相关的 API 工作。

采纳答案by dcanh121

To check if you have properly installed ADT goto -> Window -> Preferences. If you see Android (in the preferences), it means you have ADT installed.

要检查您是否已正确安装 ADT,请转到 -> 窗口 -> 首选项。如果您看到 Android(在首选项中),则表示您已安装 ADT。

To point to the valid SDK directory, click on Android. Specify the location in the SDK location.

要指向有效的 SDK 目录,请单击 Android。在 SDK 位置中指定位置。

Even if you have correctly installed ADT and SDK, there is a chance that eclipse may not recognize as the Android project if you import it(depends on the project & files). Best thing is, to create a new Android project and copy the files from the imported project to the newly created Android project. This will definitely work.

即使您正确安装了 ADT 和 SDK,如果您导入它(取决于项目和文件),eclipse 也有可能无法识别为 Android 项目。最好的事情是,创建一个新的 Android 项目并将文件从导入的项目复制到新创建的 Android 项目。这肯定会奏效。

回答by Mahdi Naderian

Two things to consider:

需要考虑的两件事:

  1. Open project properties -> Android section, see if Android SDK is selected or not. if no SDK is selected just check it.

  2. In project properties -> Java Compiler section, change "Compiler compliance level" to "1.6". This is because you have installed JDK 1.7 that has some problems with some packages!

  1. 打开项目属性 -> Android 部分,查看是否选择了 Android SDK。如果没有选择 SDK,只需检查它。

  2. 在项目属性 -> Java 编译器部分,将“编译器合规级别”更改为“1.6”。这是因为您安装的 JDK 1.7 有一些包有问题!

回答by johngoche9999

I right clicked on the project and selected properties and added Google APIs 2.3.3 as the target and did a project->clean and was able to launch the application. Many thanks.

我右键单击该项目并选择了属性并添加了 Google APIs 2.3.3 作为目标并执行了一个项目->clean 并能够启动该应用程序。非常感谢。

回答by SeanPONeil

Most likely your ADT plugin is not pointing to the Android SDK. Follow the instructions for installing and configuring the plugin:

很可能您的 ADT 插件没有指向 Android SDK。按照说明安装和配置插件:

http://developer.android.com/sdk/eclipse-adt.html

http://developer.android.com/sdk/eclipse-adt.html