查看: 12442|回复: 0

中国大陆地区如何下载Android源码

[复制链接]

404

主题

245

回帖

2万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
20383
发表于 2018-5-2 19:35:31 | 显示全部楼层 |阅读模式
中国大陆地区如何下载Android源码由于Android SDK的部分仓库需要从Google服务器下载,中国大陆地区用户,可以通过如下两种方式下载完整Android源码:
  • 使用VPN直接下载源码
    • 优点:直接下载,无需额外修改XML文件
    • 缺点:需要使用VPN,根据不同VPN提供商网速可能较慢
  • 使用内地镜像服务器下载
    • 优点:国内镜像服务器访问速度更快
    • 缺点:需要额外修改XML文件
VPN方式不再介绍,如下方法基于清华大学镜像服务器:

[url=][/url]
  1. gouwa@Server:~/project/khadas/aosp/.repo/manifests$ git diff
  2. diff --git a/default.xml b/default.xml
  3. index f48a988..b8cb9da 100644
  4. --- a/default.xml
  5. +++ b/default.xml
  6. @@ -1,6 +1,6 @@
  7. <?xml version="1.0" encoding="UTF-8"?>
  8. <manifest>
  9. -  <remote fetch="https://android.googlesource.com/" name="aosp" review="https:/
  10. +  <remote fetch="https://aosp.tuna.tsinghua.edu.cn/" name="aosp" review="https:
  11.    <remote fetch="https://github.com/khadas/" name="github"/>
  12.    
  13.    <default remote="github" revision="refs/heads/Nougat" sync-j="4"/>
  14. gouwa@Server:~/project/khadas/aosp/.repo/manifests$
复制代码

常见问题:
  • repo在运行过程中会尝试访问Google官方的git源更新自己,因此在运行过程中有可能出现”无法连接gerrit.googlesource.com“的问题,解决方案参考这里
  • 下载过程中如果报如下错误,检查上述VPN或者修改XML方法是否正确配置*
  1. ...
  2. Fetching project platform/prebuilts/sdk
  3. 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
  4. fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/sdk/': Failed to connect to android.googlesource.com port 443: Connection timed out
  5. fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/tools/': Failed to connect to android.googlesource.com port 443: Connection timed out
  6. fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/sdk/': Failed to connect to android.googlesource.com port 443: Connection timed out
  7. error: Cannot fetch platform/prebuilts/tools
  8. error: Cannot fetch platform/prebuilts/sdk

  9. error: Exited sync due to fetch errors
  10. gouwa@Server:~/project/khadas/aosp$
复制代码








风火轮微信公众号
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|风火轮WIKI|手机版|小黑屋|深圳风火轮团队 ( 粤ICP备17095099号 )

GMT+8, 2024-3-28 19:30 , Processed in 0.047504 second(s), 19 queries .

快速回复 返回顶部 返回列表
 
【客服1】 商务合作 15289193
【客服2】 业务洽谈 13257599
【客服3】 售前咨询 510313198
【邮箱】
smartfire@smartfire.cn