Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse not Recognizing any imports

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

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?

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.

like image 788
Aneem Avatar asked Jan 11 '12 21:01

Aneem


People also ask

Why import option is not working in Eclipse?

Go to Preferences » Java » Editor » Content Assist » Advanced. Make sure Other Java Proposals is ticked/checked. If that does not work simply close the project and reopen it.

How do I fix all imports in Eclipse?

Go to the line of unused import, press Ctrl + 1, which is an Eclipse shortcut of a quick fix. This will show a drop-down menu to fix this error and one of them will be “remove unused imports.” It will remove that import statement from the Java file.

How do I enable auto import in Eclipse?

As you type a class name, press Ctrl+Space to bring up Eclipse's autocomplete. Once you press Enter to select it, Eclipse will automatically add an import for the class.


1 Answers

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

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

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.

like image 79
dcanh121 Avatar answered Sep 22 '22 08:09

dcanh121