国内下载android源码镜像地址及方法

来源:互联网 发布:阿里云幕布原图下载 编辑:程序博客网 时间:2024/06/08 04:23

清华的git在2016年6月24停用了,只支持https的方式,未试,详细可以看他们的说明


最下方补充中科大的地址,目前可用,源码更新至7.1.0_r4(2016年11月8日)


清华镜像地址:git://aosp.tuna.tsinghua.edu.cn/android/

说明地址:http://aosp.tuna.tsinghua.edu.cn/android/


下载 repo 
$git clone git://aosp.tuna.tsinghua.edu.cn/Android/git-repo.git/


修改repo 
$vi /git-repo.git/repo 
google的地址 
REPO_URL = ‘https://gerrit.googlesource.com/git-repo’ 
改为清华大学的地址 
REPO_URL = ‘git://aosp.tuna.tsinghua.edu.cn/android/git-repo’

下载 manifest 
google 的地址 
$ repo init -u https://android.googlesource.com/platform/manifest 
改为清华大学的地址 
$ repo init -u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest 
如果需要设置版本,加入参数-b +安卓源码版本号即可,没有则下载最新版本的源码。


如何查看源码版本号:

/build/core/version_defaults.mk

查找PLATFORM_VERSION即可。



下载时出现:repo sync error:Exited sync due to fetch errors

$repo sync -f -j4

-f  or  --force-broken flag allows it to recover from network error and more important recover on broken/missng objects

-jN use N threads   清华最大支持4线程下载



补充中科大镜像


curl https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo  > ~/bin/repo #从中科大镜像源下载repo工具
chmod a+x ~/bin/repo #更改可执行权限
mkdir ~/android #创建目录存放源码 文件名随便
cd ~/android #转到目录
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest
#如果提示无法连接到 gerrit.googlesource.com,执行 vi ~/bin/repo  把 REPO_URL 一行替换成下面的:REPO_URL = 'https://gerrit-googlesource.lug.ustc.edu.cn/git-repo'
repo sync

1 0