Android源码下载教程(repo)

环境

  • ubuntu系统

源码下载

  • 首先下载repo工具
 mkdir ~/bin 
 PATH=~/bin:$PATH 
 curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo 
 ## 如果上述 URL 不可访问,可以用下面的:
 ## curl https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo > ~/bin/repo 
 chmod a+x ~/bin/repo

  • 然后建立一个工作目录
mkdir android
cd android
  • 初始化仓库命令
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest 
## 如果提示无法连接到 gerrit.googlesource.com,可以编辑 ~/bin/repo,把 REPO_URL 一行替换成下面的: 
## REPO_URL = 'https://gerrit-googlesource.proxy.ustclug.org/git-repo'

  • 如果需要某个特定的android版本

例如我想下载 android-8.1.0_r8

repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-8.1.0_r8
  • 同步源码树
repo sync

编译相关

cd android //切到android目录下 
source build/envsetup.sh lunch //选择编译版本类型 
23 //针对不同类型选择序号,我这里选择23 user版 
make -j32 //全编,-j加快编译速度 
mmm packages/apps/Helloword/ //单模块编译 
切换到要编译的目录下 mm -B 
make clean //清除out目录文件

猜你喜欢

转载自blog.csdn.net/qq_22613757/article/details/84035360