这里再讲一遍环境安装:
系统deepin 15.4rc
1、安装软件
sudo su
apt-get install openjdk-8-jdk
apt-get install curl
apt-get install git
git config --global user.email "你的邮箱(随便一个邮箱就行了)"
git config --global user.name "你的名字"
2、下载repo与manifests
下载repo
mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
nano ~/bin/repo
修改为国内源
将REPO_URL = 'https://gerrit.googlesource.com/git-repo'改为
REPO_URL = 'https://gerrit-google.tuna.tsinghua.edu.cn/git-repo'
添加环境变量
sudo su
echo export PATH="$PATH:/home/你的用户名/bin" >> /etc/profile
source /etc/profile
exit
下载manifests
新建一个文件夹放,下载完使用 ls -al查看到一个.repo的隐藏文件夹就说明下载完成了
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
替换已有的 AOSP 源代码的 remote
如果你之前已经通过某种途径获得了 AOSP 的源码(或者你只是 init 这一步完成后),
你希望以后通过 TUNA 同步 AOSP 部分的代码,只需要将 .repo/manifest.xml 把其中的
https://aosp.tuna.tsinghua.edu.cn/。
<manifest>
<remote name="aosp"
- fetch="https://android.googlesource.com"
+ fetch="https://aosp.tuna.tsinghua.edu.cn"
review="android-review.googlesource.com" />
<remote name="github"
同时,修改 .repo/manifests.git/config,将
url = https://android.googlesource.com/platform/manifest
更改为
url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest
这个方法也可以用来在同步 Cyanogenmod 代码的时候从 TUNA 同步部分代码
3、查看最新安卓分支列表
cd .repo/manifests/
git branch -a
列出的就是全部的安卓源码分支列表了
4、下载安卓特定分支源码
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-cts-7.1_r4
5同步源码树
repo sync
参考文章:Android 镜像使用帮助