Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with importing Android platform classes

I'm new to Android. It seems there have been way too many problems just getting eclipse and the SDK setup with everything just where it should be. I've been working on an example from the Android Developer website, but it's throwing an error saying:

The import android.support cannot be resolved

I'm trying to import the following:

import android.support.v4.app.NavUtils;

I have three of the newest SDK platform versions installed and also have the rev.10 support library installed. Is the android.jar file pointing to the wrong folder? I found the folder/files that I'm trying to import but I'm wondering if they're in the right place.

C:\Program Files (x86)\Android\android-sdk\sources\android-16\android\support

I haven't moved anything since I installed everything, so I'm confused why most everything else will import but the support classes are missing. Thanks in advance for the help.

like image 997
sncrmck Avatar asked Oct 08 '12 16:10

sncrmck


People also ask

Why is Android studio not opening?

How do I fix launching Studio error? Open Start menu > computer > System Properties > Advanced System Properties. In the Advanced tab > Environment Variables, add a new system variable JAVA_HOME that points to your JDK folder, for example, C:\Program Files\Java\jdk1. 7.0_21.

How do I know my Android studio version?

Navigate to “Appearance & Behavior” > “System Settings” > “Android SDK” and now you can see the SDK versions that were installed in the “API Level” and “Name” columns (focus on “API Level”).


1 Answers

but it's throwing me an error saying "The import android.support cannot be resolved"

Everything in the android.support.* series of packages comes from the Android Support package (what I think you are calling "rev. 10 support library".

I have three of the newest SDK platform versions installed and have rev.10 support library installed

The Android Support package does not only need to be downloaded to your development machine, but it also needs to be added to your project. If you are using Eclipse, right-click over your project in the Package Explorer and choose Android Tools > Add Support Library to add it to your project. If you are not using Eclipse, find the android-support-v4.jar file in your SDK installation and copy that to your project's libs/ directory.

like image 52
CommonsWare Avatar answered Oct 26 '22 16:10

CommonsWare