Java ClassLoader vs. Android Dexclassloader:
Java ClassLoader: function: mainly used to load the class into the JVM for the program to use, that is to say: Java program can dynamically load the class definition, and this dynamic loading mechanism is implemented through the ClassLoader Core loader: A:: Bootstrap ClassLoader (startup ClassLoader)--load the Java Core API, including user-defined ClassLoader and two additional loader B: Extclassloader-"Load extension API in Java, that is, class C:appclassloader in/lib/ext --" Loader Ape's custom class, This is the class loading process under our engineering classpath : 1: When running a Java program, the JVM starts 2: Runs bootstrap ClassLoader, loads the Java Core API (Extclassloader And Appclassloader are also loaded at this time) 3: Call extclassloader Load Extension API 4: Finally Appclassloader load the custom class under Classpath directory
Android dexclassloader role: Android Development and common Java development is different from the class file is repackaged into the Dex type of file, This re-packaging optimizes the various function tables and variable tables inside the class file. The Dex file is a class file optimized by the Android packaging tool, so loading this special class file requires a special ClassLoader, so the Dexclassloader loading process is available in Android : 1: Get the installation directory for the specified apk via Packagemanager, Dex's unzip directory, directory 2: Create a Dexclassloader instance 3: Load the specified class to return a class 4: Then use reflection to call this class
Finally add a bit of Android knowledge, for the next article to prepare, that is, Android resource management, first look at this article to do an understanding of the first:
http://blog.csdn.net/luoshengyang/article/details/8738877/
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android APK Dynamic Loading technology Research (1) Basic knowledge training