How can I check if the second dex was loaded or not after installing my application?
Our app has three dexes in apk which was created by gradle with multidex function.
After installing the app
-
Were the master dex and the second dex loaded with the same classloader?
-
How can I check if the second (classes2.dex) and the third are completed or not? Can I check it dynamically in code?
-
Or can you imagine some related document on the procedure for loading a class (or dex) in Android? I am not familiar with this.
Thank.
source to share
I haven't dug into the ART code, but you can read what the Dalvik Multidex support lib does here :
- Yes. Classes in all dexes are loaded with the same
ClassLoader
. When the app is loaded, the deviceMultiDex
:- extracts additional dex files from .apk and puts them in their .zip files in the data directory (so that they are indistinguishable from APK to
ClassLoader
), - Gets
ClassLoader
from your application context and adds these new .zip files to a list thatClassLoader
knows about it.
- extracts additional dex files from .apk and puts them in their .zip files in the data directory (so that they are indistinguishable from APK to
Not only are individual desks loaded with the same ClassLoader, they are loaded with the same ClassLoader, which will be used without MultiDex.
-
Additional words should be installed automatically when downloading the application. It is not easy to test this code, but you can test it locally by checking the logs for your device.
-
There are some Android docs on ART and Dalvik architecture . But there is nothing better than reading the source :)
source to share