你好,游客 登录 注册 搜索
背景:
阅读新闻

单独编译Android源代码中的模块

[日期:2013-06-15] 来源:Linux社区  作者:wuxiaoer [字体:大 中 小]

二、使用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

linux
相关资讯       Android编译 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款