how to compile modules of Android source code independently

0 3685
After the first time load the android source project, we usually execute make command under the project directory, then android system image system.img will be availible after a long waiting. wether make command should be executed or not after one of the android module source code was modified or added into the project. the answer is not. google have provided another commands to support debugging the module and to repack the system.img commands. let's check this command before we went on learning android source code.

1.firstly,there is script file under the directory of Android/build.After execute this script,you will get some useful tools:
  1. USER-NAME@MACHINE-NAME:~/Android$ .  ./build/
Copy the Code
please remind ,this is a source command,after execute it,you will get some additional commands to use.

- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory.
- mmm: Builds all of the modules in the supplied directories.
- cgrep: Greps on all local C/C++ files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir: Go to the directory containing a file.

You can use -help to inquire how to use these command,here we just care about the mmm command .we can use this mmm command to compile all the modules under your specified directory ,generally there is only one module under your specified directory.

2.Use mmm command to compile the specified module,such as the Email program:
  1. USER-NAME@MACHINE-NAME:~/Android$ mmm packages/apps/Email/
Copy the Code
After compiling,you will get the Email.apk file under the directory of out/target/product/generic/system/app .All of the system apps are under this directory.

3.After compiling,you should pack the system.img again, therefore we can see our app when this system.img runs in your machine.
  1. USER-NAME@MACHINE-NAME:~/Android$ make snod
Copy the Code
Ok,you got it!
You have to log in before you can reply Login | Sign Up

Points Rules