美文网首页
Ubuntu环境下载android源码

Ubuntu环境下载android源码

作者: Jack_Jiao | 来源:发表于2017-12-06 22:08 被阅读0次

先说一下我的系统环境,我是在windows下使用VirtualBox安装的ubuntu-16.04.3-desktop-amd64虚拟机系统。然后由于下载源码必须翻墙,而使用代理,如果不稳定也会无法下载,所以决定使用清华镜像来下载。但还是给出官方的下载源码流程链接
以下内容是根据清华大学开源软件镜像站-Android镜像使用帮助进行总结的,亲自实践过了。

1. 下载 repo 工具

以下命令都是在用户目录下执行的

//确保主目录下有一个 bin/ 目录,并且该目录包含在路径中
$ mkdir ~/bin
$ PATH=~/bin:$PATH
//下载 Repo 工具,并确保它可执行,这里使用tuna的git-repo镜像
$ curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
$ chmod a+x ~/bin/repo

repo的运行过程中会尝试访问官方的git源更新自己,所以使用tuna的镜像源进行更新,将如下内容复制到你的~/.bashrc
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
并重启终端模拟器。

2. 使用初始化包进行初始化

wget https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
tar xf aosp-latest.tar
cd AOSP   # 解压得到的 AOSP 工程目录
# 这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录
repo sync # 正常同步一遍即可得到完整目录
# 或 repo sync -l 仅checkout代码

下一步是如何编译。

相关文章

网友评论

      本文标题:Ubuntu环境下载android源码

      本文链接:https://www.haomeiwen.com/subject/qkihmxtx.html