首先需要将AOSP完整编译一遍,才能进行单个模块编译,具体步骤如下:
/**在AOSP根目录下执行 */
1. source build/envsetup.sh
// target是编译的系统类型,比如 aosp-x86_64_eng
2. lunch <target>
// 以Contacts为例
3. mmm packages/apps/Contacts
4. make snod
5. emulator -wipe-data
修改fws模块并导入到系统中
// 以可写模式启动emulator
win@wed:~/aosp/ emulator -writable-system
// 在该目录执行[mmm]命令
win@wed:~/aosp/frameworks/base$ mmm
win@wed:~/aosp/frameworks/base$ adb root
win@wed:~/aosp/frameworks/base$ adb remount
win@wed:~/aosp/frameworks/base$ adb push ../../out/target/product/emualtor_x86_64/system/framework/framework.jar /system/framework
win@wed:~/aosp/frameworks/base$ adb reboot
这里需要注意下,必须得以可写模式启动模拟器,否则执行adb remount的时候,会出现如下错误:
adb remount can not mount overlayfs for partitions:No such file or directory
附录:
模拟器异常情况汇总
ERROR: Running multiple emulators with the same AVD is an experimental feature.
解决方案,删除如下文件:
./out/target/product/targetType/multiinstance.lock
./out/target/product/targetType/hardware-qemu.ini.lock