1. Download the Repo tool
mkdir ~/binpath=~/bin: $PATHcurl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repochmod a+x ~/ Bin/repo
2. Create source Directory
mkdir ANDROIDSRCCD ANDROIDSRC
3. Initializing the Warehouse
Repo Init-u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
A) If you are prompted that you cannot connect togerrit.googlesource.com,可以 编辑 repo 文件,
VI ~/bin/repo
PutREPO_URL 一行替换成,
Repo_url = ' Https://gerrit-google.tuna.tsinghua.edu.cn/git-repo '
b) If you need a specific Android version, such as Android-6.0.1_r46
Repo Init-u https://aosp.tuna.tsinghua.edu.cn/platform/manifest-b android-6.0.1_r46
4. Synchronous source Code
Repo Sync
You can also automatically synchronize the new script (autosync.sh)
VI autosync.sh
The autosync.sh content is as follows (rest 3 milliseconds when not connected to the terminal and then automatically repo sync),
#!/bin/bashecho "======start repo sync======" Repo syncwhile [$? = = 1]; Do echo "======sync failed, Re-sync again======" sleep 3 repo Syncdone
Android Source code Download method