首页 > 技术文章 > 通过清华TUNA镜像源下载Android源码

BrianChen 2019-01-08 22:31 原文

建议参考官方教程:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

以下为自己测试时执行的步骤:

1、下载repo

$ curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo

  

2、修改权限并拷贝到 PATH 中

$ chmod a+x repo

$ sudo mv repo /usr/bin/

  

3、使用tuna镜像源更新(需重启模拟终端)

$ vi ~/.bashrc 
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

  

4、初始化仓库

$ repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest

  

a.过程中如遇到Git错误,设置git config即可

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

b.如果需要指定Android版本

$ repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android版本

  

5、同步源码(代码比较大,耗时比较久)

$ repo sync

  

推荐阅读