DexIndexOverflowException issue after updating to latest appcompat and support library

This message sounds like your project is too large.

You have too many methods. There can only be 65536 methods for dex.

Since the gradle plugin 0.14.0 and the Build Tools 21.1.0 you can use the multidex support.

Just add these lines in the build.gradle:

android {

    defaultConfig {
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

Also in your Manifest add the MultiDexApplication class from the multidex support library to the application element

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication"> 
        ...
    </application>
</manifest>

If you are using a own Application class, change the parent class from Application to MultiDexApplication.

Leave a Comment