What is Android MultiDex?

后端 未结 5 2188
后悔当初
后悔当初 2020-11-27 12:26

There are many posts about MultiDex. I have experienced, sometimes, errors solved including multiDexEnabled true in the defaultConfig section of my

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 13:11

    It's as simple as this

    A single .dex file can have 65,536 methods(references) so if the number of references exceeds 65,536, you go with multidex.

    More Explanation!

    An android application program is compiled into a .dex file which in turn zipped to a single .apk file.
    DVM (Dalvik Virtual Machine) uses .dex file/files to execute bytecodes.

    What causes the number of references to exceed 65,536 limits?
    Methods written by you + Android Framework methods + Third party library(eg Volley,Retrofit, Facebook SDK etc) methods.
    I have read "somewhere"
    App Compat 24.2.1 contains 16.5k methods
    Google Play Services GCM 9.6.1 contains 16.7k methods
    So if you have created a simple Hello world application which has App Compat 24.2.1, you are already 1/4 way to cross the single dex methods limit

提交回复
热议问题