下载 Android 指定版本源码

Posted by on July 13, 2018

有时候我们需要下载源码,网上搜了下,乱七八糟,自己有个服务器,看到直接能下载到服务器上看,这样岂不是美哉

android源码库地址

安装 git 、curl

我的是cenos6的系统

  • mkdir ~/bin
  • PATH=~/bin:$PATH
  • yum -y install curl
  • yum -y install git
  • curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
  • chmod a+x ~/bin/repo

    以上是环境配置完毕,接下来开始下载制定版本的源码

  • git clone https://android.googlesource.com/platform/manifest
  • cd manifest/
  • git branch -a 查看当前的源码分支
  • repo init -u https://android.googlesource.com/platform/manifest -b android-2.2.2_r1 下载指定版本源码,参数 -b 后为指定版本号
  • repo sync 参考地址:https://source.android.com/source/downloading

如果出现:repo syntax error near unexpected token newline错误请确认你下的repo源,是我上面最新的,网上旧的已经失效。