Android AOSP 6.0.1 framework编译
最近再查一些 framework 流程,凭着记忆 cd 到 framework/base 下 mm ,直接报错 #### make failed to build some targets(x seconds) ####。接着 mmm 了一把,编译确实通过了,但没有 Install 路径。接下来记录一下处理方法。
针对 Nexus 5 真机,其他机器对应修改选择编译目标即可。
1.cd到源码根路径
aaa@qq.com:~/aosp/android-6.0.1_r72$
2.设置源码环境
aaa@qq.com:~/aosp/android-6.0.1_r72$ source build/envsetup.sh
3.选择编译目标,输入19(19. aosp_hammerhead-userdebug)
aaa@qq.com:~/aosp/android-6.0.1_r72$ lunch
4.cd到 frameworks/base/core/res
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base$ cd core/
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base/core$ ls
java jni res tests
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base/core$ cd res/
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base/core/res$ ls
AndroidManifest.xml assets MakeJavaSymbols.sed NOTICE
Android.mk lint.xml MODULE_LICENSE_APACHE2 res
5.编译 framework-res.apk
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base/core/res$ mm
6.编译 services.jar
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base/core/res$ cd ../..
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base$ cd services/
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base/services$ mm
7.编译 framework.jar
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base/services$ cd ..
aaa@qq.com:~/aosp/android-6.0.1_r72/frameworks/base$ mm
8.查看编译出来的文件
Install: out/target/product/hammerhead/system/framework/framework-res.apk
Install: out/target/product/hammerhead/system/framework/services.jar
Install: out/target/product/hammerhead/system/framework/framework.jar
9.手机连接PC
10.更换机器内部framework-res.apk、services.jar和framework.jar
adb root
adb remount
adb push framework-res.apk /system/framework/
adb push framework.jar /system/framework/
adb push services.jar /system/framework/
11.确保文件已修改,核对一下修改时间
adb shell
aaa@qq.com:/ # cd system/framework/
aaa@qq.com:/system/framework # ls -al
12.重启手机,验证修改
aaa@qq.com:/system/framework # exit
adb reboot
比如我在AMS里增加了一句log,已经显示出来了,说明修改生效了。
07-06 04:57:10.112 774-2032/system_process I/lhw: AMS startActivity callingPackage = com.demo.framework,resolvedType = null,resultWho = null,requestCode = -1,startFlags = 0