title: MultiDex issue - Execution failed for task ':app:dexDebug'
body: <p>I face a problem while adding a line for Google Calendar API to <code>build.gradle</code>. Here is the error: </p>
  
  <pre><code>UNEXPECTED TOP-LEVEL EXCEPTION:
  com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]:65536
      at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
  at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
  at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
  at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
  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'.
  &gt; com.android.ide.common.process.ProcessException: 
   org.gradle.process.internal.ExecException: Process 'command 
  '/usr/java/jdk1.7.0_79/bin/java''
  
  finished with non-zero exit value 2
  Information:BUILD FAILED
  Information:Total time: 14.802 secs
  Information:1 error
  Information:2 warnings
  Information:See complete output in console
  </code></pre>
  
  <p>I have tried many options but nothing is working. When I add <code>"multiDex true"</code> to <code>defaultConfig</code>, appcompat library doesn't connect to my project, and application crashes with  <code>java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$layout.</code> </p>
  
  <p>Here's my <code>build.gradle</code>:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 21
      buildToolsVersion "21.1.2"
  
  defaultConfig {
      applicationId "ua.appp.appp"
      minSdkVersion 14
      targetSdkVersion 21
      versionCode 15
      versionName "2.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.0'
  
      compile 'com.google.android.gms:play-services:6.5.87'
      compile 'com.google.apis:google-api-services-calendar:v3-rev119-1.19.1'
      compile 'com.google.api-client:google-api-client:1.19.1'
      compile 'com.google.api-client:google-api-client-android:1.19.1'
      compile 'com.google.api-client:google-api-client-gson:1.19.1'
  
      compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
      compile 'com.afollestad:material-dialogs:0.6.5.2'
      compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
      compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
      compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
  }
  </code></pre>
  
  <p>PS: Some interesting fact: When I add all these libraries to a test project, code compiles and works fine without an error.</p>