Janusz Janusz - 1 year ago 211
Android Question

How to enable multidexing with the new Android Multidex support library

I want to use the new Multidex support library to break the method limit for one of my apps.

With Android Lollipop Google introduced a multidex support library that makes it easy to multidex.

What steps are needed to use this library and to build my app with multidex support?

Answer Source

Since December 3rd, 2014, build tools 1.0.0-rc1 was released. Now, all you need to do is override this in your Application class:

public class YouApplication extends Application {

    protected void attachBaseContext(Context base) {


and modify your build.gradle like so:

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14 //lower than 14 doesn't support multidex
             targetSdkVersion 22

             // Enabling multidex support.
             multiDexEnabled true

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

For more info, this is a good guide.