1.首先得到部分编译的工具:
进入android源码根目录后执行 . ./build/envsetup.sh
2.进入到要单独编译的文件夹中
cd frameworks/base/location
mm
3.编译好模块后,还要重新打包一下system.img文件
进入android源码根目录后执行 make snode
4.更新API
make update-api
5.自定义 ADT 的默认 SDK 中 API 的版本
即为自定义 android.jar(用编译后的 android.jar 覆盖 ADT 默认 SDK 中的 android.jar)
目的为在 ADT 中可以引用增加或者修改的 API
Source:/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
Destination:/adt/sdk/platforms/android-19/android.jar
首先将 Source 和 Destination 处的 android.jar 直接打开,然后将 Source 中 android.jar 的内容全部拖动到
Destination 中的 android.jar 里面。
※此步骤必须有,否则在 ADT 中无法正常调用修改的 API
6.安装编译好的Android镜像到模拟器上。
7.运行模拟器可能会出错,说是找不到emulator
重启系统后:
执行emulator,出现如下错误:
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '@<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
Otherwise, follow the instructions in -help-disk-images to start the emulator
解决:
source build/envsetup.sh
lunch sdk-eng
然后再执行
emulator
可以启动模拟器