Android Application construction principle

Source: Internet
Author: User

Android is an open-source mobile phone operating system developed by Google based on the Linux platform. Each Android Application corresponds to an independent Dalvik Virtual Machine instance at the underlying layer, and its code can be executed under the explanation of the virtual machine, after the system is released, it greatly facilitates users' needs.

Each Android Application runs in a Dalvik Virtual Machine instance, and each virtual machine instance is an independent process space. Virtual Machine thread mechanism, memory allocation and management. Mutex depends on the underlying operating system. All Android Application threads correspond to a Linux thread. Therefore, virtual machines can rely more on the thread scheduling and management mechanisms of the operating system.

Different applications run in different process spaces. In addition, different Linux users are used for applications from different sources to maximize the Security and independent operation of applications. Zygote is a virtual machine process and also an incubator for Virtual Machine instances. Whenever the system requires an Android Application to be executed, zygote will generate a sub-process to execute the application.

The advantages of doing so are obvious: the zygote process is generated when the system starts. It completes VM initialization, Library Loading, loading and initialization of Preset class libraries, and so on, when the system needs a new Virtual Machine instance. Zygote provides the fastest system by replicating itself. In addition, for some read-only system libraries, All VM instances share a memory area with zygote, greatly saving the memory overhead.

After the application package (APK) is published to the mobile phone, the DEX file is optimized before running, the optimized file is saved to the cache (the optimized format is called Dey), and the file is executed directly. If the application package file does not change, the Dey file will not be regenerated.

 

Android applications use the Java programming language. Similar to Java SE, Sun JDK is used to program Java source programs into standard Java bytecode files (. class files) during compilation ). Then, the tool DX converts all bytecode files into Dex files (classes. Dex ).

Finally, the android packaging tool (aapt) is used to combine Dex files, resource files, and androidmanifest. xml files (in binary format) into an application package (APK ). Application packages can be published to mobile phones for running. Then the Dalvik has a virtual opportunity to read commands and data from it.

 

 

Reprinted from: http://developer.51cto.com/art/201002/182944.htm

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.