Android的源代码下载教程

mkdir ~/bin
PATH=~/bin:$PATH
下载repo工具并让它具有可执行权限
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
由于国内上网限制还可以用清华大学TUNA镜像源,由于清华大学TUNA镜像源关闭了git://协议,仅支持HTTPS,所以需将REPO_URL修改为:
https://aosp.tuna.tsinghua.edu.cn/android/git-repo才可以正常使用
git clone https://aosp.tuna.tsinghua.edu.cn/android/git-repo
cp git-repo/repo  ~/bin/      //将上一个步骤中得到的git-repo中的repo文件拷贝到bin目录
sudo  vim   ~/bin/repo
REPO_URL = 'https://aosp.tuna.tsinghua.edu.cn/android/git-repo'
在用户的home目录下新建Android_src目录,并用repo初始化指定android某个版本的分支
mkdir  ~/android-8.0.0_r10 //新建目录
cd  ~/android-8.0.0_r10 //进入目录
配置git的用户信息
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
repo关联android源码
repo init -u https://android.googlesource.com/platform/manifest //会关联最新的android版本
如果要指定某个版本
repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r10 // -b设置分支,android-8.0.0_r10分支名
--------------------- 


cd android  //切到android目录下
source build/envsetup.sh
lunch       //选择编译版本类型
23          //针对不同类型选择序号,我这里选择23 user版
make -j32   //全编,-j加快编译速度
mmm packages/apps/Helloword/ //单模块编译
切换到要编译的目录下 mm -B
make clean  //清除out目录文件

 

https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/   参考华清镜像
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值