title: Android: WireMock: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
body: <p>Gradle 3.3, WireMock 2.6.0.
  I build my Android project by Gradle. I write my unit test by Espresso, Mockito and all work fine.</p>
  
  <p>Here my build.gradle:</p>
  
  <pre><code>dependencies {
      // for folder "androidTest"
      androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
      androidTestCompile "org.mockito:mockito-android:2.7.21"
      androidTestCompile "org.powermock:powermock-api-mockito:1.6.6"
      androidTestCompile 'org.powermock:powermock-module-junit4:1.6.6'
  
      // for folder "test"
      testCompile 'junit:junit:4.12'
      testCompile 'org.powermock:powermock-api-mockito:1.6.6'
      testCompile 'org.powermock:powermock-module-junit4:1.6.6'
      }
  </code></pre>
  
  <p>And my project is success build and unit test success run. OK.
  Now I want to add WireMock unit test. So I change my build.gradle (as show this blog: <a href="http://handstandsam.com/2016/01/30/running-wiremock-on-android/" rel="nofollow noreferrer">http://handstandsam.com/2016/01/30/running-wiremock-on-android/</a>):</p>
  
  <pre><code>    dependencies {
  // for folder "androidTest"
  androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
  androidTestCompile "org.mockito:mockito-android:2.7.21"
  androidTestCompile "org.powermock:powermock-api-mockito:1.6.6"
  androidTestCompile 'org.powermock:powermock-module-junit4:1.6.6'
  
  //WireMock
  androidTestCompile("com.github.tomakehurst:wiremock:2.6.0") {
      //Using Android Version Instead
      exclude group: 'org.apache.httpcomponents', module: 'httpclient'
  
      //Version conflict with our app's slf4j version
      exclude group: 'org.slf4j', module: 'slf4j-api'
  
      //Was getting a classpath conflict for org.objectweb.asm.AnnotationVisitor which is a part of 'net.minidev:asm'
      exclude group: 'org.ow2.asm', module: 'asm'
  
      //Was getting this warning, so decided to ignore this version included by WireMock.
      //Warning:Dependency org.json:json:20090211 is ignored as it may be conflicting with the internal version provided by Android.
      //In case of problem, please repackage with jarjar to change the class packages
      exclude group: 'org.json', module: 'json'
  }
  
  // for folder "test"
  testCompile 'junit:junit:4.12'
  testCompile 'org.powermock:powermock-api-mockito:1.6.6'
  testCompile 'org.powermock:powermock-module-junit4:1.6.6'
  }
  </code></pre>
  
  <p>When I run my app all is OK. But when I try to start my instrumented unit test for Android I get the next error:</p>
  
  <pre><code>    :app:compileDevAndroidTestShaders
  :app:generateDevAndroidTestAssets
  :app:mergeDevAndroidTestAssets
  :app:transformClassesWithDexForDevAndroidTest FAILED
  
  FAILURE: Build failed with an exception.
  
  What went wrong:
  Execution failed for task ':app:transformClassesWithDexForDevAndroidTest'.
  com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
  Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED
  </code></pre>