Android平台源码下载以及编译--ubuntu 11.04

1.  下载android平台的源码树

a)     安装repo

Repo是在android背景下支持能更好的支持git的一个工具,实际上repo是一个python的脚本。

按照以下步骤安装,初始化,配置repo

1)       Mkdir ~/bin

2)       PATH=$PATH:~/bin

3)       Curl https://android.git.kernel.org/repo >~/bin/repo

4)       Chmod a+x ~/bin/repo

 

b)     初始化repo客户端

1)       Mkdir /your/work/directory

2)       Cd /your/work/directory

3)       Repo init –u git://android.git.kernel.org/platform/manifest.git

如果你要指定下载哪个branch,使用参数-b

4)       Repo init –u git://android.git.kernel.org/platform/menifest.git –b froyo

如果成功初始你的客户端,那么在最后会打印“Repo is initialized in your work directory”,并且,在你的工作目录下,会有.repo这个隐藏的文件夹。

 

c)     下载源码

下载menifest中指明的库:

1)       Repo sync

2)       上面的下载时间会有点长,等着,执行结束,那么android源码就拿到手了,我们先来看下如果编译android系统。

 

2.  编译android平台

a)         根据envsetup.sh脚本来初始化系统的编译环境

1)       Source build/envsetup.sh

或者使用

2)       . build/envsetup.sh

b)         选择目标平台:通过lunch交互命令

1)       Lunch full-eng //这个是为android模拟器进行全部编译,并打开所有的debug模式。

2)       如果使用lunch时没有使用参数,那么会提供一个平台的菜单让你选择,根据自己平台的模式,进行选择设置。

c)         开始编译:

1)       Make –j4

 

3  模拟android设备

         a)      确定emulator在系统的可执行文件的路径下。

                   1  emulator

 

常见错误:

a)       “You are attempting to build with the incorrect version…”

1)       安装jdk失败,重新安装:http://source.android.com/source/initializing.html

2)       Jdk的工作目录没有加到path环境变量中去:

Export PATH=$PATH:/your/jdk/path/tools

b)       Python命令找不到

1)       Apt-get install python

 

参考网站:

         http://source.android.com/source/initializing.html

         http://source.android.com/source/downloading.html

         http://source.android.com/source/building.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值