How to enable multidexing with the new Android Multidex support library

后端 未结 14 2380
逝去的感伤
逝去的感伤 2020-11-21 12:57

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

14条回答
  •  隐瞒了意图╮
    2020-11-21 13:48

    Step 1: Change build.grade

    defaultConfig {
        ...
        // Enabling multidex support.
        multiDexEnabled true
    }
    
    dependencies {
        ...
        compile 'com.android.support:multidex:1.0.0'
    }
    

    Step 2: Setting on the Application class

    public class MyApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            MultiDex.install(this);
        }
    }
    

    Step 3: Change grade.properties

    org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
    

    It will work!. Thanks.

提交回复
热议问题