AOSP下载(非FQ)

参考资料:

  • 自己动手编译Android源码(超详细)(https://www.jianshu.com/p/367f0886e62b)
  • AOSP项目环境搭建 http://blog.csdn.net/fengshh2301/article/details/54016445
  • AOSP 安卓源码-ubuntu开发环境搭建 https://www.cnblogs.com/zhen-android/p/7764124.html
  • 使用本地AOSP镜像快速获取Android代码 http://blog.csdn.net/sy373466062/article/details/55101705

中科大源

https://lug.ustc.edu.cn/wiki/mirrors/help/aosp#初始同步方法2

可在线查看中科大镜像内容:
https://mirrors.ustc.edu.cn/aosp/

export REPO_URL='https://gerrit-googlesource.proxy.ustclug.org/git-repo'
或者
export REPO_URL='https://mirrors.ustc.edu.cn/aosp/git-repo.git/'


清华大学源:

参考 Google 教程 https://source.android.com/source/downloading.html, 将 https://android.googlesource.com/ 全部使用 https://aosp.tuna.tsinghua.edu.cn/ 代替即可。

export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

下载repo工具

curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
mkdir ~/bin/repo
mv repo ~/bin/repo
chmod +x ~/bin/repo

离线库

wget https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
tar xf aosp-latest.tar

cd AOSP   # 解压得到的 AOSP 工程目录

#已有仓库如何改用科大源,请修改 .repo/manifests.git/config,将
# url = https://android.googlesource.com/platform/manifest
# 修改成
# url = git://mirrors.ustc.edu.cn/aosp/platform/manifest
# 或 https://mirrors.ustc.edu.cn/aosp/platform/manifest

# 这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录
repo sync # 正常同步一遍即可得到完整目录

# 或 repo sync -l 仅checkout代码        

Android 模拟器编译

下载模拟器代码分支

# repo init -u https://android.googlesource.com/platform/manifest -b emu-2.5-release
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest  -b emu-2.5-release
repo init -u https://mirrors.ustc.edu.cn/aosp/platform/manifest  -b emu-2.6-release

编译

cd external/qemu/android/
./rebuild.sh --no-tests

其它见:http://blog.csdn.net/tq08g2z/article/details/77932200

中科大源失败:

Fetching projects:   2% (1/37)  Fetching project platform/prebuilts/cmake/windows-x86
Fetching projects:   5% (2/37)  Fetching project platform/prebuilts/android-emulator-build/curl
error: Cannot fetch platform/prebuilts/cmake/windows-x86
Fetching project platform/external/angle
fatal: remote error: access denied or repository not exported: /aosp/platform/external/angle
error: Cannot fetch platform/prebuilts/android-emulator-build/curl
error: Cannot fetch platform/prebuilts/android-emulator-build/protobuf
error: Cannot fetch platform/prebuilts/ninja/windows-x86
fatal: remote error: access denied or repository not exported: /aosp/platform/external/angle
error: Cannot fetch platform/external/angle

清华大学源:

Fetching project platform/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8
Fetching project platform/prebuilts/ninja/windows-x86
Fetching project platform/external/tinyobjloader
Fetching project platform/prebuilts/android-emulator-build/protobuf
error: no such remote ref c179f1c3d3fcddfe22e1692756a3912dd42996f6
error: Cannot fetch platform/prebuilts/android-emulator-build/protobuf
Fetching project platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8
Fetching projects:   2% (1/39)  error: no such remote ref b88e85c90e260cfed1d5130499b8dfd7bb9dc02a
error: Cannot fetch platform/prebuilts/ninja/windows-x86
Fetching projects:   7% (3/39)  
error: Exited sync due to fetch errors   

踩坑

  • 踩坑1:
    https://www.jianshu.com/p/3b0a9904daca

  • 踩坑2:
    Not replacing locally modified commit-msg hook
    windows下解压的tar文件,释放时有些link没有正确的释放。
    在ubuntu下重新解压即可

  • 坑3:
    在 repo init -u https://mirrors.ustc.edu.cn/aosp/platform/manifest -b emu-2.6-release 后,repo sync后在clone部分manifest中clone-depth为1的结点时出错。
    日志见:https://gist.github.com/k1988/9558b4591f6607be1dd578d65b9e92d8

临时解决方案:
如果出错,就将.repo/manifest.xml中改为

正确解决方案:
后面联系清华的管理员,问题是清华的镜像 @huiyiqun 服务器上 git 需要更新到 2.5 以上,他打开 uploadpack.allowReachableSHA1InWant 这个选项后即可。

  • 坑4:
    /aosp/platform/external/angle 下载失败。

    huiyiqun17:29:59 default.xml - mirror/manifest - Git at Google
    https://android.googlesource.com/mirror/manifest/+/master/default.xml via telegram
    huiyiqun17:30:17 我们是依据这个文件镜像的 via telegram
    huiyiqun17:30:27 这个文件里没有…

清华大学没有同步非master的git。

你可能感兴趣的:(AOSP下载(非FQ))