ubuntu编译android部分源码

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镜像到模拟器上。

1. 设置环境变量:
USER-NAME@MACHINE-NAME:~/Android$ export PATH=$PATH:~/Android/out/host/linux-x86/bin  
USER-NAME@MACHINE-NAME:~/Android$ export ANDROID_PRODUCT_OUT=~/Android/out/target/product/generic
其中, ~/Android/out/host/linux-x86/bin有我们要执行的emulator命令,而 ~/Android/out/target/product/generic是Android镜像存放目录,下面执行emulator命令时会用到。
2. 运行模拟器。
USER-NAME@MACHINE-NAME:~/Android$ emulator

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

可以启动模拟器










评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值