title: Error : java.lang.NoClassDefFoundError Android
body: <p>I am following this <a href="http://www.truiton.com/2015/06/android-tabs-example-fragments-viewpager/">tutorial to create swipe tabs</a>. But I get the above error.</p>
  
  <p>My gradle dependencies sturucture</p>
  
  <pre><code>dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:appcompat-v7:23.1.1'
  compile 'com.android.support:design:22.2.0'
  }
  </code></pre>
  
  <p>Here are my files. <code>MainActivity.java</code></p>
  
  <pre><code>import android.support.design.widget.TabLayout;
  import android.support.v4.view.ViewPager;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.support.v7.widget.Toolbar;
  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);
  
  
      TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
      tabLayout.addTab(tabLayout.newTab().setText("Tab 1")); //this line gives error
      tabLayout.addTab(tabLayout.newTab().setText("Tab 2")); //this line gives error
      tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
  
      final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
      PageAdapter pageAdapter = new PageAdapter(getSupportFragmentManager());
      viewPager.setAdapter(pageAdapter);
      viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
      tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
          @Override
          public void onTabSelected(TabLayout.Tab tab) {
              viewPager.setCurrentItem(tab.getPosition());
          }
  
          @Override
          public void onTabUnselected(TabLayout.Tab tab) {
  
          }
  
          @Override
          public void onTabReselected(TabLayout.Tab tab) {
  
          }
      });
   }
  
  }
  </code></pre>
  
  <p>And my <code>PageAdapter.java</code> file is</p>
  
  <pre><code>import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentStatePagerAdapter;
  
  public class PageAdapter extends FragmentStatePagerAdapter {
  
    public PageAdapter(FragmentManager fm) {
      super(fm);
    }
  
    @Override
    public Fragment getItem(int position) {
  
      switch (position) {
          case 0:
              return new InstaPicSwipeTab();
          case 1:
              return new SongsDownloadSwipeTab();
      }
      return null;
   }
  
   @Override
   public int getCount() {
      return 2;
   }
  }
  </code></pre>
  
  <p>And this is what LogCat is giving me</p>
  
  <pre><code>12-08 00:27:24.452 11770-11770/com.example.suraj.freewee E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             Process: com.example.suraj.freewee, PID: 11770
                                                                             java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/internal/widget/TintManager;
                                                                                 at android.support.design.widget.TabLayout$TabView.&lt;init&gt;(TabLayout.java:1041)
                                                                                 at android.support.design.widget.TabLayout.createTabView(TabLayout.java:582)
                                                                                 at android.support.design.widget.TabLayout.addTabView(TabLayout.java:616)
                                                                                 at android.support.design.widget.TabLayout.addTab(TabLayout.java:334)
                                                                                 at android.support.design.widget.TabLayout.addTab(TabLayout.java:309)
                                                                                 at com.example.suraj.freewee.MainActivity.onCreate(MainActivity.java:23)
                                                                                 at android.app.Activity.performCreate(Activity.java:6237)
                                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                 at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                 at android.os.Looper.loop(Looper.java:148)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                              Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.internal.widget.TintManager" on path: DexPathList[[zip file "/data/app/com.example.suraj.freewee-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.suraj.freewee-1/lib/x86, /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)
                                                                                 at android.support.design.widget.TabLayout$TabView.&lt;init&gt;(TabLayout.java:1041) 
                                                                                 at android.support.design.widget.TabLayout.createTabView(TabLayout.java:582) 
                                                                                 at android.support.design.widget.TabLayout.addTabView(TabLayout.java:616) 
                                                                                 at android.support.design.widget.TabLayout.addTab(TabLayout.java:334) 
                                                                                 at android.support.design.widget.TabLayout.addTab(TabLayout.java:309) 
                                                                                 at com.example.suraj.freewee.MainActivity.onCreate(MainActivity.java:23) 
                                                                                 at android.app.Activity.performCreate(Activity.java:6237) 
                                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                 at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                 at android.os.Looper.loop(Looper.java:148) 
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                 at java.lang.reflect.Method.invoke(Native Method) 
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                              Suppressed: java.lang.ClassNotFoundException: android.support.v7.internal.widget.TintManager
                                                                                 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)
                                                                                      ... 19 more
                                                                              Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
  </code></pre>
  
  <p>How to solve this error?</p>