开始Android源码分析学习~
转载请标明出处:http://blog.csdn.net/zhijunhong/article/details/51052597 谢谢!~
Ubuntu14.04系统下载Android源码,直接上步骤:
1.Curl的安装:
$ sudo apt-get install curl
2.Git的安装:
$ sudo apt-add-repository ppa:git-core/ppa // 这样可以获得最新版本的git
$ sudo apt-get update //更新数据源
$ sudo apt-get install git
3.Repo的安装:
$ mkdir ~/bin // 创建~/bin目录
$ PATH=~/bin:$PATH // 将~/bin:$PATH加入到PATH变量中
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo // 下载repo到~/bin/repo的目录
## 如果上述 URL 不可访问,可以用下面的:
## curl https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo > ~/bin/repo
(note:有时地址不能访问,等待大约10min再试试~)
$ chmod a+x ~/bin/repo // 赋予repo可执行的权限
4.Android源码的下载
先创建一个用来下载源码的目录:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
如果想要获取最新的Android源码,则需要执行如下命令:
$ repo init -u https://android.googlesource.com/platform/manifest
如果你目标明确,已经很清楚自己想下载哪个版本的Android源码,那么也可以执行初始化一个确定的版本
$ repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r
如果提示无法连接到 gerrit.googlesource.com,可以编辑 ~/bin/repo,把 REPO_URL 一行替换成下面的:
REPO_URL = ‘https://gerrit-googlesource.lug.ustc.edu.cn/git-repo’
相应的初始化也需要修改如下:如果需要某个特定的 Android 版本(Android 版本列表):
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-4.0.1_r1
notice:
如果是第一次使用git,那么可能会遇到这样的问题——GitError:manifests var:Please tell me who you are.
这是因为你第一次在这个系统中使用git,还没有相应的个人信息,解决办法其实也已经直接告诉你了,就是执行2句命令:
$ git config --global user.email “[email protected]”
$ git config -- global user.name “Your Name”
初始化结束后,执行同步命令:
扫描二维码关注公众号,回复:
11329127 查看本文章
$repo sync
就可以下载Android源码了~
下载成功后的截图:
希望能对刚进入Android源码分析阶段的猿类一些帮助!~~