中国大陆地区如何下载Android源码由于Android SDK的部分仓库需要从Google服务器下载,中国大陆地区用户,可以通过如下两种方式下载完整Android源码:
- 使用VPN直接下载源码
- 优点:直接下载,无需额外修改XML文件
- 缺点:需要使用VPN,根据不同VPN提供商网速可能较慢
- 使用内地镜像服务器下载
- 优点:国内镜像服务器访问速度更快
- 缺点:需要额外修改XML文件
VPN方式不再介绍,如下方法基于清华大学镜像服务器:
[url=][/url]
- gouwa@Server:~/project/khadas/aosp/.repo/manifests$ git diff
- diff --git a/default.xml b/default.xml
- index f48a988..b8cb9da 100644
- --- a/default.xml
- +++ b/default.xml
- @@ -1,6 +1,6 @@
- <?xml version="1.0" encoding="UTF-8"?>
- <manifest>
- - <remote fetch="https://android.googlesource.com/" name="aosp" review="https:/
- + <remote fetch="https://aosp.tuna.tsinghua.edu.cn/" name="aosp" review="https:
- <remote fetch="https://github.com/khadas/" name="github"/>
-
- <default remote="github" revision="refs/heads/Nougat" sync-j="4"/>
- gouwa@Server:~/project/khadas/aosp/.repo/manifests$
复制代码
常见问题:- ...
- Fetching project platform/prebuilts/sdk
- Fetching projects: 66% (4/6) fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/tools/': Failed to connect to android.googlesource.com port 443: Connection timed out
- fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/sdk/': Failed to connect to android.googlesource.com port 443: Connection timed out
- fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/tools/': Failed to connect to android.googlesource.com port 443: Connection timed out
- fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/sdk/': Failed to connect to android.googlesource.com port 443: Connection timed out
- error: Cannot fetch platform/prebuilts/tools
- error: Cannot fetch platform/prebuilts/sdk
- error: Exited sync due to fetch errors
- gouwa@Server:~/project/khadas/aosp$
复制代码
|