Add the Android app to the android source code

Source: Internet
Author: User

(1) Part 1: Add a new application

1. Add the project source code to <andrid_src>/packages/apps, for example, the helloworld project.

2. Create the Android. mk file in the root directory of the helloworld project. The content is as follows:


Local_path: = $ (call my-DIR)
Include $ (clear_vars)
# Indicates the target mode
Local_module_tags: = user
# Indicates the source file compilation path
Local_src_files: = $ (call all-Java-files-under, Src )/
# Indicates the project package name
Local_package_name: = helloworld
# Included Libraries
Include $ (build_package)



3. Go to the <android_src>/build/target/product directory, modify the core. mk,, and SDK. mk files, and add your project to the compilation list.

Example: core. mk

Product_packages: =/


4. global compilation

Go to the <android_src> source code root directory

$ Make or $ Mmm package/apps/helloworld (or make helloworld)

$Run make Snod to compile the system. IMG package.

$Execute emulator & and you will be able to see your own project under the application.


1. Create an android project and load your own java files and resource files.
2. After the preliminary debugging of your android project is successful, copy the Java file and resource file of the project to the corresponding Java file and resource file directory of the contact.

3. Then, run the following command in Linux to compile the contact module and compile the resource file into the contact directory.
. Build/envsetup. Sh
Mmm packages/apps/contacts
4. Refresh the android source code project. At this time, you can view the newly added resource files and source files in the contacts package directory. You can modify the code under the source code project and debug it directly.
5 .?? Why not add source files and XML resource files directly under the android source code project ????
A: Because our android source code engineer imported it using a Java project, if the android XML file is added, the Java program cannot identify the resource R file, so we must first
XML resource files are first compiled in Linux
6. after modifying the source code project, you can execute the contact compilation command again in Linux and make Snod to load the system. imgfile, and start the emulator &) to view your modifications.





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: 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.