Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java android.support.v4.widget.DrawerLayout not being found

android.support.v4.widget.DrawerLayout; is not being found on my phone when I test the app. why is this happening and how do I fix it?

I don't know yet but I think I may be having the same problem with android.support.v4.view.GravityCompat; and android.support.v4.app.ActionBarDrawerToggle; if they do cause any problems.

I have never had any problems with android.support.v4.*; before but now it's not working. I have android.support.v4 lib (the may one).

Edit: better error message

my error

05-27 19:46:21.230: E/jdwp(11659): Failed sending reply to debugger: Broken pipe
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 30: Landroid/support/v4/widget/DrawerLayout;.closeDrawer (Landroid/view/View;)V
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 27: Landroid/support/v4/app/ActionBarDrawerToggle;.onConfigurationChanged (Landroid/content/res/Configuration;)V
05-27 19:46:21.290: E/dalvikvm(11659): Could not find class 'android.support.v4.widget.DrawerLayout', referenced from method com.MainActivity.onCreate
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve check-cast 16 (Landroid/support/v4/widget/DrawerLayout;) in Lcom/MainActivity;
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 28: Landroid/support/v4/app/ActionBarDrawerToggle;.onOptionsItemSelected (Landroid/view/MenuItem;)Z
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 29: Landroid/support/v4/app/ActionBarDrawerToggle;.syncState ()V
05-27 19:46:21.290: W/dalvikvm(11659): VFY: unable to resolve virtual method 31: Landroid/support/v4/widget/DrawerLayout;.isDrawerOpen (Landroid/view/View;)Z
05-27 19:46:21.290: W/dalvikvm(11659): Unable to resolve superclass of Lcom/MainActivity$1; (14)
05-27 19:46:21.290: W/dalvikvm(11659): Link of class 'Lcom/MainActivity$1;' failed
05-27 19:46:21.340: W/dalvikvm(11659): threadid=1: thread exiting with uncaught exception (group=0x40bc71f8)
05-27 19:16:42.404: E/dalvikvm(10623): Could not find class 'android.support.v4.widget.DrawerLayout', referenced from method com.MainActivity.onCreate
05-27 19:16:42.464: E/AndroidRuntime(10623): FATAL EXCEPTION: main
05-27 19:16:42.464: E/AndroidRuntime(10623): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MainActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class android.support.v4.widget.DrawerLayout
like image 246
Spik330 Avatar asked May 28 '13 02:05

Spik330


People also ask

What is the latest version of Android drawerlayout?

androidx.drawerlayout:drawerlayout:1.1.0 is released. Version 1.1.0 contains these commits. Major changes since 1.0.0 DrawerLayout now takes into account the size of any gesture navigation insets, expanding the area available to users to long press and swipe to open the drawer when gesture navigation is enabled.

What's new in drawerlayout?

Major changes since 1.0.0 DrawerLayout now takes into account the size of any gesture navigation insets, expanding the area available to users to long press and swipe to open the drawer when gesture navigation is enabled. DrawerLayout now supports setting a default style using the drawerLayoutStyle theme attribute.

How do I implement a material design drawer widget in Android?

Implement a Material Design drawer widget. To add a dependency on DrawerLayout, you must add the Google Maven repository to your project. Read Google's Maven repository for more information. Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

How do I add drawerlayout dependencies to my project?

To add a dependency on DrawerLayout, you must add the Google Maven repository to your project. Read Google's Maven repository for more information. Add the dependencies for the artifacts you need in the build.gradle file for your app or module: For more information about dependencies, see Add build dependencies.


1 Answers

If you recently updated your ADT your Library Build Paths might have been messed up. Try the following:

  1. Right click on Project
  2. Build Path -> Configure Build Path
  3. Tab: Order and Export
  4. Make sure your Android and Android Dependencies libraries are checked
  5. Clean & Build your Project

During my last ADT update all of them became unchecked and I had similar errors.

like image 184
Daniel Lerps Avatar answered Sep 21 '22 00:09

Daniel Lerps