IgorGanapolsky
IgorGanapolsky

Reputation: 26821

Android build error DexIndexOverflowException

I am not able to build my Android app. I keep seeing this error:

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:484) at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261) at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:473) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106)

However, it doesn't tell me which gradle dependencies are causing my build to fail. How do I go about troubleshooting this?

Igor

Upvotes: 2

Views: 2327

Answers (1)

IgorGanapolsky
IgorGanapolsky

Reputation: 26821

It seems the only way to solve my dilemma was to enable multidex in my project:

  1. In AndroidManifest.xml:

<application android:name="android.support.multidex.MultiDexApplication"

  1. In app's build.gradle:

dependencies { compile 'com.android.support:multidex:1.0.0' and

defaultConfig {
     testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"
     multiDexEnabled true

Upvotes: 4

Related Questions