I am studying multiDex on the Android platform. Here is https://developer.android.com/tools/building/multidex.html#mdex-gradle . When I use the multiDex support library, the apk output will contain files with several dex, such as class.dex, class1.dex, class2.dex. Then I write a class named myApplication , inherited from Application , and override the api attachBaseContext . In the method, I call MultiDex.install() in the same way as recommended.
My question is what happens if I used MultiDex.install() in onCreate ?
I know that attachBaseContext is called before onCreate , so attachBaseContext is called better. Howerver, actually I want to know why it is only recommended here? Is this a situation where a ClassNotFoundException is thrown when I call it in onCreate?
java android
kidoher
source share