android-从官网下拉源码(ubuntu)

今天终于成功的从谷歌官网上下载了android 源码。中间折腾了好久,最终总算有所收获

1.下载repo

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

如果你ubuntu下还没有安装curl,你可以使用如下命令下载

sudo apt-get install curl

然后给repo设置可执行权限

chmod a+x ~/bin/repo

2.repo init

到你存放源码的路径

参考网上的资料,说的是用如下的方法就可以了

repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r9

不过,我一直没有成功,说的是连接不上。不知道是不是跟翻墙有关。

折腾了半天,后来在网上看到了另外一个方法,执行成功了。

1)修改~/bin/repo文件,设置REPO_URL如下

REPO_URL = 'git://aosp.tuna.tsinghua.edu.cn/android/git-repo' 

2)初始化repo

repo init -u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest -b android-5.1.1_r4

3.然后我们就可以通过repo sync 来来代码了

repo sync

 

原文地址:https://www.cnblogs.com/zhangshuli-1989/p/hq_151023173.html