AOSP 解释为"Android Open-Source Project"的缩写。中文意为"Android 开放源代码项目";
按照常规我们下载android源码是依照Android开源说明https://source.android.com/source/downloading.html在地址https://android.googlesource.com/同步源码。
但是由于某些原因我们不再能简单的登录google服务器了,只能借助翻墙软件或者第三方国内AOSP服务器(比如中科大、清华)来获取,个人真不敢恭维。
下面我们简单记录下操作方法,以便备忘:
1、翻墙,找个软件或插件比如蓝灯(landern)这种可以翻过网络的限制,只是可能网络相对有点慢毕竟是代理出去的。
2、国内有几个提供AOSP Android开源工程系统镜像的服务站,我们可以借助他们间接的同步android源码下来,虽然不是很爽但也是无奈之举。
据了解,国内比较知名的有两个一个中科大还有一个是清华,具体使用方法可以参考一下连接:
中科大AOSP:
https://lug.ustc.edu.cn/wiki/mirrors/help/aosp
清华AOSP:
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
就拿清华为例,毕竟学校比较牛逼:
一、下载repo工具
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
## 如果上述 URL 不可访问,可以用下面的:
## curl https://storage-googleapis.proxy.ustclug.org/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
二、创建工作目录并初始化仓库
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
三、指定特定Android版本
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1
四、同步源码树(以后只需执行这条命令来同步)
repo sync
五、替换镜像文件
如果你之前已经通过某种途径获得了 AOSP 的源码(或者你只是 init 这一步完成后),你希望以后通过 TUNA 同步 AOSP 部分的代码,只需要将 .repo/manifest.xml 把其中的 aosp 这个 remote 的 fetch 从 https://android.googlesource.com 改为 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