How to avoid DEX 64K LIMIT by importing the right library

后端 未结 5 781
栀梦
栀梦 2021-02-14 11:03

I had this issue where I overflow the 64k method limit in Dalvik when compiling all the library I used. I started to have this issue when I imported the Support

5条回答
  •  野的像风
    2021-02-14 12:05

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

    and also add this method into your application class

    @Override
    protected void attachBaseContext(Context newBase) {
    
        super.attachBaseContext(newBase);
    
        MultiDex.install(this);
    }
    

提交回复
热议问题