Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Import DrawerLayout cannot be resolved

I'm trying to import the classes required to use the new "Navigation Drawer" from Android http://developer.android.com/design/patterns/navigation-drawer.html#ImpactOnNav

DrawerLayout: http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html

ActionBarDrawerToggle: http://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html

The import android.support.v4.widget.DrawerLayout cannot be resolved The import android.support.v4.app.ActionBarDrawerToggle cannot be resolved

I have updated the libraries to the latest version but still these classes are not recognized.

like image 412
Eric Bergman Avatar asked Jun 11 '13 14:06

Eric Bergman


1 Answers

How do I update the JARs in libs?

I usually do it by copying the file. You will find the JARs inside $ANDROID_SDK/extras/android/support, where $ANDROID_SDK is wherever your Android SDK is installed.

If you use Eclipse, if you copy this at the filesystem level, and Eclipse is open, press <F5> with the project highlighted in Package Manager so Eclipse picks up the changes. Easier is to drag it out of the SDK and drop the JAR into libs/ right in Eclipse, which will both update the filesystem and let Eclipse know about the change.

It's possible that the Eclipse option to add the JARs (right-click over the project, then choose Android Tools > Add Support Library... from the context menu) will also do this. That particular approach doesn't work for me due to some peculiarities with my development environment.

like image 95
CommonsWare Avatar answered Oct 13 '22 15:10

CommonsWare