Android Development and compilation system

Source: Internet
Author: User

first, the development of Android is divided into three types

Porting development of mobile device systems; Android system-level development; applications

Android can be divided into four levels, from the bottom up to: The Linux kernel, C + +
libraries, Java frameworks, and Java applications .

1. porting Development mobile devices : involving the Linux kernel (including its drivers)
2. Android System-level development:It involves the development of C + + library and the upper Java framework;Refers to the extension of the Android framework or modify the bug, this is less, unless some developers of mobile devices, such as GPS, can add some of their own specific system things, which may lead to some incompatibilities. Of course, it could be a simple bug fix.
3. A ndroid Application development is calling Javathe framework of the write application, this should be a more mainstream development, which is to write applications to the Android system.

Simple from top to bottom, Android applications need to have Java framework support, such as it to send text messages, it needs the Java framework, Java framework is actually the C/S library wrapper into a jni, and the implementation of the specific function is the C/S library finally drive the hardware to complete the function, This is part of the Linux kernel.

Ii. Introduction to development work
Based on the above, Android development is divided into SDK development and source code development.
1, SDK development, mainly application development.
2, the source code development, involves the knowledge has the Linux operating system basic knowledge, the Android bottom-level library and so on knowledge.

Iii. Overview of Android system-level development
The so-called framework, that is, system-level development, although the development of Android framework is relatively small, but the understanding of it is more conducive to the overall development, of course, many equipment manufacturers still need these .

1, Android system architecture  
Linux kernel and driver, C + + framework, Java framework, Java application.  
1) Linux kernel and driver  
where the Linux kernel and drivers are kernel-level, the system always needs the support of the operating system, such as memory management, process management, network protocol stack and so on.  
2) the C/C + + framework of Android  
System C Library: With libc, there is nothing to say, C. programmers know.  
Multimedia Library:  
SurFace Manager: Displays the subsystem's manager  
Libwebcore:web browser engine, supports Android browser  
Sgl:skia Graphics library, the underlying 2D graphics engine  
3D Library: opengl 
FreeType: Font display  
Android operating environment, this should belong to this framework, Android virtual machine is called  
Dalvik, the running environment is made up of this virtual machine and the underlying Java class library.  
3) Android application framework  
provides a range of services and systems, including views, content providers, resource managers, notification managers, live  , and
Dynamic manager.   The
view is very rich: list, grid, text box, button, and so on.   The
content provider is the data that enables an application to access another program.  
Resource Manager is a resource access that provides access to non-code, such as a layout file.  
notifies the manager so that the program can display a customized prompt in the status bar.   The
Activity manager, which is used to manage the program life cycle.  
4) Android app  
All Android applications are written in Java, and of course it now seems to support some scripting languages, such as  
Ruby, but C development is not supported, so-called C development refers to JNI The form.

Second,Android Build system

Android build system is used to compile Android system, Android SDK and related documents. The system consists mainly of make files, Shell scripts, and Python scripts. The most important processing logic in the Build system is in the make file, while the other script files are just a few of the auxiliary functions.

The make files in the entire Build system can be divided into three categories:
The first class is the build system core file, which defines the framework for the entire build system, and all other make files are written on the basis of this framework. The Build system core files are all located in the/build/core directory.
The second category is a make file for a product (a product may be a phone or tablet of a certain model), which is usually located in the device directory, which is also categorized as a two-level directory with the company name and product name. The definition of a product typically requires a set of files, which together form the definition of the product.
The third class is a make file for a module. The entire system contains a large number of modules, each with a dedicated make file, the name of which is unified "ANDROID.MK", which defines how to compile the current module. The build system scans the entire source tree for files named "Android.mk" and executes the compilation of modules based on their contents.

The Android compilation steps are as follows:
1.source build/envsetup.sh: Loads all the commands used in envsetup.sh into the environment variable
2.lunch: Choose Platform Compilation options
3.make: Perform the compilation. The parameter "-j" of Make specifies the number of concurrently compiled jobs, which is typically 1 time or twice times the total number of concurrent threads supported by the compiled host CPU, such as: Make–j8
The entry file for the entire Build system is a file named "Makefile" under the source root directory, and the make command reads the file first when the make command is called on the source code root. The contents of the Makefile file are only one line: "Include build/core/main.mk". The line code is obvious: it contains the build/core/main.mk file. Other files will be included in the Main.mk file, and more files will be included in the other file, thus introducing the entire Build system.

The directory structure of the Build result
All of the compilation artifacts will be located in the/out directory with the following subdirectories:
/out/host/: This directory contains the product of Android development tools for the host. That is, the various tools in the SDK, such as: EMULATOR,ADB,AAPT, etc.
/out/target/common/: This directory contains common compilation artifacts for devices, primarily Java application code and Java libraries.
/out/target/product/<product_name>/: Contains compilation results for a specific device and platform-related C + + libraries and binaries. Where,<product_name> is the name of the specific target device.
/out/dist/: Contains packages prepared for multiple distributions, copy files to the directory via "Make Disttarget", and the default compilation target does not produce the directory.

Build-generated image file
The most important product of Build is three image files, which are located in the/out/target/product/<product_name>/directory. These three files are:
System.img: System files, libraries, executables, and pre-installed applications that contain the Android OS will be mounted as root partitions.
RAMDISK.IMG: The Linux kernel is mounted as a read-only partition at boot time, it contains the/init file and some configuration files. It is used to mount other system images and start the init process.
USERDATA.IMG: will be mounted as/data, containing the application-related data and user-related data.

Android Development and compilation system

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.