Build Android System apk
1, set up the environment
Export android_home=/home/administrator/soft/android
export path= $PATH: $ANDROID _home/out/host/linux-x86/bin
Export android_product_out= $ANDROID _home/out/target/product/generic
2, create the project
Android Create Project-t 1-k com.lhw.led-a mainactivity-p./led Avd id:1,it
' s Get by command "Android list"
p roject name:led
Package:com.lhw.led
Main activity:mainactivity
Project Path:./
The next step is to write your own Android program.
3, the preparation of android.mk
android.mk need to be placed under the project root path, that is, under the LED, content:
Local_path : = $ (call My-dir)
include $ (clear_vars)
local_src_files : = $ (call all-subdir-java-files)
local_package_name : = LED
local_java_libraries : =
local_static_java_libraries: =
Include $ (build_package)
4, compile
execute under the Android source directory:
./build/envsetup.sh
mmm/home/administrator/workspace/android_test/led/
Execution results:
install:out/target/product/generic/system/app/led.apk
Build Android System executable command
The Android system allows developers to write "LS" commands on their Android systems.
1, the preparation of C documents: MYCMD.C
#include <stdio.h>
int main (int argc, char **argv)
{
printf ("This are My command!\n");
return 0;
}
2, the preparation of ANDROID.MK documents
Local_path : = $ (call My-dir)
local_src_files: = mycmd.c
local_module : = myCMD
local_module_tags : = myCMD
local_shared_libraries: = libc
local_static_libraries: =
include $ (build_executable)
3, compile
mmm/home/administrator/workspace/android_test/mycmd/
After the compilation completes the information:
Install:out/target/product/generic/system/bin/mycmd