一:安裝repo
1:建立bin目錄,并倒入環境變量,運作如下指令:
mkdir ~/bin
PATH=~/bin:$PATH
2:下載下傳repo,并且使其可執行:
# 使用清華大學鏡像
repo curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
#修改repo權限,
chmod a+x ~/bin/repo
二:初始化repo
1:建立存儲源碼的目錄,并進入目錄
zhuxiujun:~ zhuxiujun$ mkdir AOSP/android8.0
zhuxiujun:~ zhuxiujun$ cd ~/AOSP/android8.0/
2:初始化倉庫:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.0.8_r1
具體下載下傳哪一個版本,可以到http://androidxref.com/上查找。
3:倒入清華大學環境變量:
zhuxiujun:~ zhuxiujun$ export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
4: 删掉repo目錄下面的.repo,然後再執行初始化:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.0.8_r1
5:開始同步代碼
repo sync
以我的網速,時間大概需要1個小時,大小差不多60G.
完畢!
參考文獻:https://yujianbin.github.io/2018/06/12/MAC%E7%B3%BB%E7%BB%9F%E4%BD%BF%E7%94%A8repo%E4%B8%8B%E8%BD%BDandroid%E6%BA%90%E7%A0%81/