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

后端 未结 5 780
栀梦
栀梦 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 11:58

    hey you can try my trick, it might be useful for you

    1. First of all you should avoid external libraries. Like in that libraries have same dependencies. So, try to merge that library with android application code. Due to this save much space for methods.

    2. Use useful dependencies and libraries like if you want google play services then include only useful services not all.See example

      compile "com.google.android.gms:play-services-location:9.4.0"
      compile "com.google.android.gms:play-services-maps:9.4.0" 
      

    Avoid this

    compile 'com.google.android.gms:play-services:9.4.0'
    
    1. Remove unwanted dependencies.Use very chooseable dependencies in your code.

    2. If all things not work really well then use multidex in your code.But it create Multiple dex files.So, your code will take much time for compilation.

    Thanks hope this will help you.

提交回复
热议问题