title: Cannot use android.support.v7.widget.DrawerLayout in Android
body: <p>I am absolute beginner to Android. I start learning how to use action bar in android very well with navigation drawer. I already created a simple app using android.support.v4.widget.DrawerLayout layout in xml file.</p>
  
  <p>It was working fine. But when I use <code>android.support.v7.widget.DrawerLayout</code> instead, it is throwing error. But when I changed it back to android.support.v4.widget.DrawerLayout,it is working fine.</p>
  
  <p>This is my activity_main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;android.support.v7.widget.DrawerLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/main_drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;!-- This LinearLayout represents the contents of the screen  --&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
  
          &lt;!-- The ActionBar displayed at the top --&gt;
          &lt;include
              layout="@layout/action_bar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content" /&gt;
  
          &lt;!-- The main content view where fragments are loaded --&gt;
          &lt;FrameLayout
              android:id="@+id/main_content"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;!-- The navigation drawer that comes from the left --&gt;
      &lt;!-- Note that `android:layout_gravity` needs to be set to 'start' --&gt;
      &lt;android.support.design.widget.NavigationView
          android:id="@+id/nvView"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:background="@android:color/white"/&gt;
          &lt;!--app:headerLayout="@layout/nav_header"
          app:menu="@menu/drawer_view" /&gt;--&gt;
  
  &lt;/android.support.v7.widget.DrawerLayout&gt; 
  </code></pre>
  
  <p>This is the action_bar.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.Toolbar
      android:id="@+id/toolbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;/android.support.v7.widget.Toolbar&gt;
  </code></pre>
  
  <p>This is my MainActivity.java</p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.View;
  import android.view.Menu;
  import android.view.MenuItem;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>This is the errors in logcat when I run it</p>
  
  <pre><code>01-29 11:22:43.026 20642-20642/? D/dalvikvm: Late-enabling CheckJNI
  01-29 11:22:43.118 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
  01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
  01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: VFY: unable to resolve interface method 17962: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
  01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
  01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
  01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: VFY: unable to resolve interface method 17966: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
  01-29 11:22:43.122 20642-20642/com.blog.waiyanhein.llks.llks D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
  01-29 11:22:43.190 20642-20642/com.blog.waiyanhein.llks.llks D/AndroidRuntime: Shutting down VM
  01-29 11:22:43.190 20642-20642/com.blog.waiyanhein.llks.llks W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa617d908)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: FATAL EXCEPTION: main
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blog.waiyanhein.llks.llks/com.blog.waiyanhein.llks.llks.MainActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class android.support.v7.widget.DrawerLayout
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:99)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:137)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5041)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:511)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:  Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class android.support.v7.widget.DrawerLayout
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.blog.waiyanhein.llks.llks.MainActivity.onCreate(MainActivity.java:15)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:5104)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.access$600(ActivityThread.java:141) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:99) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:137) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5041) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:511) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.DrawerLayout" on path: /data/app/com.blog.waiyanhein.llks.llks-2.apk
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.createView(LayoutInflater.java:552)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:466) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.blog.waiyanhein.llks.llks.MainActivity.onCreate(MainActivity.java:15) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:5104) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.access$600(ActivityThread.java:141) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:99) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:137) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5041) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:511) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
  01-29 11:22:43.210 20642-20642/com.blog.waiyanhein.llks.llks E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method) 
  </code></pre>
  
  <p>What is wrong with my code?</p>