Android APK Dynamic Loading technology Research (1) Basic knowledge training

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.