2011年1月11日 星期二

[Android] Compile Android module

1.add environment variables
$ cd /path/to/android
$ cd build
$ . envsetup.sh
$ help
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- 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.

Look at the source to view more functions. The complete list is:
add_lunch_combo cgrep check_product check_variant choosecombo chooseproduct choosetype choosevariant cproj croot findmakefile gdbclient get_abs_build_var getbugreports get_build_var getprebuilt gettop godir help isviewserverstarted jgrep lunch m mm mmm pid printconfig print_lunch_menu resgrep runhat runtest setpaths set_sequence_number set_stuff_for_environment settitle smoketest startviewserver stopviewserver systemstack tapas tracedmdump

2.using mmm to compile module under root path
$ cd /path/to/android
$ mmm external/ping
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2.1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=MASTER
============================================
target Non-prelinked: ping (out/target/product/generic/symbols/system/bin/ping)
Install: out/target/product/generic/system/bin/ping

2.or using mm to compile module under module path
$ cd /path/to/android
$ cd development/samples/NotePad
$ mm
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2.1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=MASTER
============================================
Copying: out/target/common/obj/APPS/NotePad_intermediates/classes-full-debug.jar
Install: out/target/product/generic/system/app/NotePad.apk
Copying: out/target/common/obj/APPS/NotePadTests_intermediates/classes-full-debug.jar
Install: out/target/product/generic/data/app/NotePadTests.apk

2.or using make to compile module under root path
$ cd /path/to/android
$ make Phone
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2.1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=MASTER
============================================
Install: out/host/linux-x86/bin/aapt
Install: out/host/linux-x86/bin/aidl
Copying: out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes-full-debug.jar
Install: out/host/linux-x86/framework/dx.jar
Install: out/host/linux-x86/bin/dx
Copying: out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes-full-debug.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar
Copying: out/target/common/obj/APPS/Phone_intermediates/classes-full-debug.jar
Install: out/host/linux-x86/framework/signapk.jar
Install: out/host/linux-x86/bin/zipalign
target Package: Phone (out/target/product/generic/obj/APPS/Phone_intermediates/package.apk)
 'out/target/common/obj/APPS/Phone_intermediates/classes.dex' as 'classes.dex'...
Install: out/target/product/generic/system/app/Phone.apk

沒有留言: