二、使用mmm编译指定模块
以下是通过mmm编译Android中自带的一个试验性的应用,命令如下:
www.linuxidc.com@Ubuntu:~/my_android$ mmm packages/experimental/CameraPreviewTest/
============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=4.2.2.2.2.2.2.2.2.2
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.8.9-x86_64-with-Ubuntu-10.04-lucid
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
OUT_DIR=out
============================================
make: Entering directory `/home/www.linuxidc.com/my_android'
target R.java/Manifest.java: VideoChatCameraTestApp (out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates/src/R.stamp)
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
target Java: VideoChatCameraTestApp (out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Copying: out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates/emma_out b/classes-jarjar.jar
Copying: out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates/classes.jar
Copying: out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates proguard.classes.jar
target Dex: VideoChatCameraTestApp
Copying: out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates proguard.classes.dex
target Package: VideoChatCameraTestApp (out/target/product/generic/obj/APPS/VideoChatCameraTestApp_intermediates/package.apk)
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
'out/target/common/obj/APPS/VideoChatCameraTestApp_intermediates/classes.dex' as 'classes.dex'...
Processing target/product/generic/obj/APPS/VideoChatCameraTestApp_intermediates/package.apk
Done!
Install: out/target/product/generic/data/app/VideoChatCameraTestApp.odex
Install: out/target/product/generic/data/app/VideoChatCameraTestApp.apk
编译完成之后,就可以在out/target/product/generic/data/app/VideoChatCameraTestApp.apk目录下看到VideoChatCameraTestApp.apk文件了。
注:
Android系统自带的App是放在目录~/my_android/out/target/product/generic/system/app下。
另外,Android系统的一些可执行文件,例如:
C编译的可执行文件,放在out/target/product/generic/system/bin目录下,
动态链接库文件放在out/target/product/generic/system/lib目录下,
硬件抽象层(HAL)接口文件防砸out/target/product/generic/system/lib/hw目录下。
三、打包编译后的模块到system.img中
打包命令如下:
www.linuxidc.com@ubuntu:~/my_android$ make snod
四、运行模拟器查看结果
www.linuxidc.com@ubuntu:~/my_android$ emulator
更多Android相关信息见Android 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=11
更多Android相关信息见Android 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=11
