环境要求
OS macos 10.11.6
安装repo
安装curl
安装git
1. 新建一个用于存放下载脚本文件的目录
mkdir ~/bin
PATH=~/bin:$PATH
2. 下载Repo脚
git clone https://aosp.tuna.tsinghua.edu.cn/android/git-repo.git/
cp git-repo.git/repo ~/bin/
3. 修改Repo文件
使用gedit打开~/bin/repo 文件
把 REPO_URL = 'https://gerrit.googlesource.com/git-repo'
替换为 REPO_URL = 'https://gerrit-google.tuna.tsinghua.edu.cn/git-repo'
4. 创建Android源代码的存放目录
mkdir AndroidSource
cd AndroidSource
5. 下载初始包
去https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly中下载最新的aosp-latest.tar文 件以及对应的md5值,为了验证文件的完整性,下载后使用
md5sum aosp-latest.tar
检查一下md5值
6. 解压初始包
使用
tar -vxzf aosp-latest.tar
7. 下载android源码
先选择你要下的那个分支:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-6.0.1_r63
同步代码
repo sync -j4
如果同步出现问题的话,请看我的博文:
[linux下编写.sh文件,用于执行傻瓜命令]
8. 源码存放位置
同步下来后,源码将放在AndroidSource/6.0.1/.repo/repo目录下