您的位置:首页 > 其它

源码下载--ubuntu系统中下载安卓源码

2016-08-13 13:47 190 查看
 安卓源码下载官方指导文档:http://source.android.com/source/downloading.html

一、安装curl、git和Repo

curl:是利用URL语法在命令行方式下工作的开源文件传输工具,在这里它的作用就在于,协助安装Repo。

git:当下最为流行的分布式版本控制系统,用于项目管理

Repo:Google专门为管理Android源码开发的一个封装了大量git命令的工具。

Curl的安装:$ sudo apt-get install cu

 

$sudoapt-getinstallcurl

 
Git的安装:$ sudo apt-add-repository ppa:git-core/ppa // 这样可以获得最新版本的git
$ sudo apt-get update
$ sudo apt-get install git

1
2
3

$sudoapt-add-repositoryppa:git-core/ppa//这样可以获得最新版本的git

$sudoapt-getupdate
$sudoapt-getinstallgit

Repo安装:$ mkdir ~/bin // 创建~/bin目录
$ PATH=~/bin:$PATH // 将~/bin:$PATH加入到PATH变量中
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo // 下载repo到~/bin/repo的目录
$ chmod a+x ~/bin/repo // 赋予repo可执行的权限

1
2
3
4

$mkdir~/bin                   //创建~/bin目录

$PATH=~/bin:$PATH   
//将~/bin:$PATH加入到PATH变量中
$curlhttps://storage.googleapis.com/git-repo-downloads/repo>~/bin/repo//下载repo到~/bin/repo的目录

$chmoda+x~/bin/repo//赋予repo可执行的权限

二、Android源码的下载

1. 创建下载源码的目录

mkdir Android

cd Android


2.repo init


下载最新的安卓源码:$ repo init -u https://android.googlesource.com/platform/manifest
$repoinit-uhttps://android.googlesource.com/platform/manifest

  
下载指定版本的安卓源码:$ repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r8

1

$repoinit-uhttps://android.googlesource.com/platform/manifest
-b android-2.3.1_r1

3 . git 个人信息注册

如果是第一次使用git,那么可能会遇到这样的问题——GitError:manifests var:Please tell me who you are.





这是因为你第一次在这个系统中使用git,还没有相应的个人信息,解决办法其实也已经直接告诉你了,就是执行2句命令。

$gitconfig--globaluser.email“you@example.com”

$gitconfig--globaluser.name“YourName”

注意把引号中分别换成你的邮箱和名字就行了。

4. repo sync
初始化结束后,执行repo sync,就可以开始下载Android源码了。这个过程会比较漫长

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  环境搭建