ubuntu 16.04下载Android源代码

由于众所周知的原因,我们是没办法正常下载Android的源代码的,因此只能使用国内的镜像来操作了。

1.安装repo工具

$ sudo apt-get install repo

2.在需要存储代码的地方创建文件夹

$ mkdir ~/Android_Source

$ cd ~/Android_Source

# 国内手工下载 repo 源代码,解决 “fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle”
 
$ git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo .repo/repo

3.使用镜像下载Android源代码
omapzoom.org的镜像

$ repo init -u git://git.omapzoom.org/platform/manifest

清华大学的镜像

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

上面执行之后是拉取全部的代码。

如果要使用某个特定分支的版本的源代码的话,则则初始化的时候指定分支,比如我想要Android 7.0.0_r21的分支,则执行如下命令

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

4.同步代码

$ repo sync -j4

5.列出全部分支

$ cd .repo/manifests && git branch -a | cut -d / -f 3

6.切换到指定分支

$ repo start Android_7.0.0_r21 7.0.0_r21 --all

7.查看当前的分支

$ repo branches

8.删除不用的本地分支

$ repo abandon Android_7.0.0_r21

参考链接


发布者

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注