下载android源码

建议翻墙跟着官网操作,下载一下源

官网https://source.android.com/source/downloading

Installing Repo

Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see the Developing section.

To install Repo:

  1. Make sure you have a bin/ directory in your home directory and that it is included in your path:

    $ mkdir ~/bin
    $ PATH=~/bin:$PATH
    
    
  2. Download the Repo tool and ensure that it is executable:

    $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo
    
下载配置好repo后,创建目录然后sync源码

mkdir android_source2.3

cd android_source2.3

 

mkdir android_source2.3

cd android_source2.3 repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.1_r1 #下载android-2.3.1_r1源码 #下载哪个分之按个人需求,eg 如下是下载android-7.1.1_r13 的源码,
#repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r13   #下载android-7.1.1_r13源码

repo sync

推荐执行如下shell脚本来替代repo sync

vim auto_repo.sh

---------------------------------
#!/bin/bash
for (( ; ; ))
do
  repo sync -j16   #开更多job去sync代码,当然快慢取决于机器性能和网络
 
  if [ $? == 0 ]; then
    break;
  fi
done

---------------------------------------

chmod a+x auto_repo.sh

./auto_repo.sh


然后执行repo start master --all  #checkout 默认分支为本地master branch

代码下载完了接下来准备开始编译源码,如果你想在本地安装一堆包,配置各种JDK /OPENJDK的那好吧,当我什么都没说,但是如果想摆脱配置编译环境的烦恼,我推荐使用docker来编译android源码,真的是so easy,再也不需要配置环境了。docker编译源码的介绍在如下文。





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值