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