Write an Android built-in Android program

Source: Internet
Author: User

When we have compiled the Android source code, we need to do something to him, I am now looking at Lao Luo's "Android Source code Scenario analysis" book. The main point here is to record some of the books are not clearly stated in the place.

Same. Let's create a HelloWorld program and look at my folder structure below.

Then we just like to develop the Android program as usual. Put a Hello world string in the first interface and test it on your phone. Successful execution. All right. The work at the back is more important.

Here is a record of the contents of android.mk, this is a must have. Because MMM compiles the words. The Mk file needs to be found for compilation.

LOCAL_PATH:$(call my-dir)include$(CLEAR_VARS)LOCAL_MODULE_TAGS:= optionalLOCAL_SRC_FILES:$(call all-subdir-java-files)LOCAL_PACKAGE_NAME:HelloAndroidinclude$(BUILD_PACKAGE)

We copy this androidproject to the/packages/experimental folder under the Android source folder and empty the contents of the Gen folder and Bin folder in the HelloWorld project. This step is important, or it will compile the error. At the same time. For now I don't know how to compile this project if I have external dependencies.

Below we import the MMM command that compiles the module separately. In accordance with Lao Luo's idea, in the command line mode. Go to the Android source code root folder and execute the command:

source ./build/envsetup.sh

Such We'll be able to use the MMM command. Let's see what the MMM command can do. Use the following command to view the help documentation for the MMM command.

mmm -help

In general, it is basically the folder path where the program is added after the MMM command.

mmm ./packages/experimental/HelloWorld/

Once the compilation is complete, we can use the make Snod command to package the Android image file again.

make snod

Once we've compiled it, we'll be able to see our HelloWorld become our Android built-in program once we execute emulator again.

Write an Android built-in Android program

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.