title: Android SnackBar giving exception and not working
body: <p>I have tried new <a href="https://developer.android.com/reference/android/support/design/widget/Snackbar.html" rel="nofollow noreferrer">Snackbar</a> from the official design library provided by Google. I have downloaded new Design library through SDK and put it into libs folder. I am using eclipse and whenever I tried to run it it gives exception. I don't want to use any extra third party library other then Google.</p>
  
  <p><strong>java code</strong></p>
  
  <pre><code>import android.os.Bundle;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  
  
  public class MainActivity extends AppCompatActivity  {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Snackbar.make(v, "hello", Snackbar.LENGTH_LONG)
                          .setAction("Action!", new View.OnClickListener() {
                              @Override
                              public void onClick(View v) {
                                  // NOP
                              }
                          })
                          .show();
              }
          });
  
      }
  </code></pre>
  
  <p><strong>XML</strong> </p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.examples.androidmpreview.MainActivity"
      android:id="@+id/rl_parent" &gt;
  
      &lt;LinearLayout
          android:id="@+id/ll_vertical"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"
          android:orientation="vertical" &gt;
  
          &lt;TextView
              android:id="@+id/textView1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/hello_world" /&gt;
  
          &lt;Button
              android:id="@+id/button1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@+id/textView1"
              android:layout_marginLeft="50dp"
              android:layout_marginTop="104dp"
              android:layout_toRightOf="@+id/textView1"
  
              android:text="Button" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.examples.androidmpreview, PID: 26176
   java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/design/R$layout;
  at android.support.design.widget.Snackbar.&lt;init&gt;(Snackbar.java:119)
  at android.support.design.widget.Snackbar.make(Snackbar.java:140)
  at com.examples.androidmpreview.MainActivity$1.onClick(MainActivity.java:20)
  at android.view.View.performClick(View.java:4761)
  at android.view.View$PerformClick.run(View.java:19767)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:135)
  at android.app.ActivityThread.main(ActivityThread.java:5312)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.R$layout" on path: DexPathList[[zip file "/data/app/com.examples.androidmpreview-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
  ... 13 more
  Suppressed: java.lang.ClassNotFoundException: android.support.design.R$layout
  at java.lang.Class.classForName(Native Method)
  at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
  at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
  ... 14 more
  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  </code></pre>
  
  <p><strong>tried link</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/30612985/android-snackbar-not-working">Android SnackBar: error inflating SnackbarLayout</a></p>