title: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
body: <p>Hello I am working on a project for which I am using Android Studio. I have setup everything but when I run my project then I get below errors. I could not resolve it for last 2 days. What could be the problem in my project that causing this error</p>
  
  <p>Please help if anyone know about this.</p>
  
  <p>app build.gradle</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 22
      buildToolsVersion "21.1.2"
  
      defaultConfig {
          applicationId "in.xyz"
          minSdkVersion 15
          targetSdkVersion 22
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:22.0.+'
      //compile files('libs/android-support-v4.jar')
      compile 'com.android.support:support-v4:22.0.+'
      compile 'com.android.support:support-annotations:20.0.0'
  }
  </code></pre>
  
  <p>library build.gradle</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 22
      buildToolsVersion "21.1.2"
  
      defaultConfig {
          minSdkVersion 15
          targetSdkVersion 22
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
  }
  
  dependencies {
      //compile files('libs/android-support-v4.jar')
      compile 'com.android.support:support-v4:22.0.+'
      compile 'com.android.support:support-annotations:20.0.0'
  }
  </code></pre>
  
  <p>build.gradle</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:1.1.0'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>UNEXPECTED TOP-LEVEL EXCEPTION:
      com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
          at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
          at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
          at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
          at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
          at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
          at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
          at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
          at com.android.dx.command.dexer.Main.run(Main.java:246)
          at com.android.dx.command.dexer.Main.main(Main.java:215)
          at com.android.dx.command.Main.main(Main.java:106)
      Error:Execution failed for task ': app:dexDebug'.
  </code></pre>
  
  <p>settings.gradle</p>
  
  <pre><code>include ':app'
  include ':multiStateToggleButton'
  </code></pre>