android最新源码(4.4.2_r1版本以上)下载

参考:http://source.android.com/source/downloading.html

红色字体表示多项选择中,我所做的选择

(我百度云盘地址:http://pan.baidu.com/s/1hqABuc8)

安装curl工具

$ sudo apt-get install curl

git工具的安装(按照如下方式安装最新版)

增加ppa

$sudo apt-add-repository ppa:git-core/ppa

$sudo apt-get update

$sudo apt-get install git

git的版本号就是最新的

$git --version

git version 1.8.5.2

错误:sudo apt-add-repository ppa:git-core/ppa时出现错误:gpg: requesting keyE1DF1F24from hkp server keyserver.ubuntu.com / gpgkeys: HTTP fetch error 7: couldn't connect to host

原因:keyserver.ubuntu.com使用非标准的11371端口,而一般公司的防火墙都屏蔽掉了该端口,而允许标准的80端口。

所以可以以如下方式强行使用80端口添加软件源:

$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 E1DF1F24

绿色部分是你要请求的Key.

repo工具的下载

google是这样告诉我们的:

$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

但是好像是不能访问

解决方法:http://code.google.com/p/git-repo/downloads/detail?name=repo-1.12这个链接提供下载repo

也可以通过下面命令得到:

$ curl http://git-repo.googlecode.com/files/repo-1.12 > ~/bin/repo

我是用在http后面加了个s下载的1.20,居然可以,没有其他版本出的错误

$curl https://commondatastorage.googleapis.com/git-repo-downloads/repo > ./repo

具体的repo版本可以去查看http://code.google.com/p/git-repo/downloads页面上的信息,下载那个版本都行。

修改执行权限

$ chmod a+x repo

repo init创建仓库

初始化android 源代码,下载最新代码

$./repo init -u https://android.googlesource.com/platform/manifest

或者像这样取得某个分支如android-4.4.2_r1

$ ./repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r1

如果需要下载其他分支将android-4.4.2_r1改成其他分支名称就可以了。分支名称请在https://android.googlesource.com/platform/manifest/+refs里面查看branch

执行repo sync 进行同步

$ ./repo sync

使用repo sync同步下载代码时因为网络原因可能会经常断线,可以使用下面的脚本来做个脚本文件,让它中断后,又自动下载

创建脚本download.sh

#!/bin/bash

echo "=========start repo sync=============="

./repo sync

while [ $? == 1 ]; do

echo "======sync failed, re-sync again======"

sleep 3

./repo sync

done

chomd a+x download.sh让其可以运,然后终端输入./download.sh就可以开始下载了,用这一步代替官方文档里的repo sync。当连接不上终端时休息3毫秒然后再自动repo sync

下载完成后,下一步就是编译了

补充:

对于我网盘下载的内容同步出源码的方法如下:

Usinga local mirror

When using several clients, especially in situationswhere bandwidth is scarce, it is better to create a local mirror of the entire servercontent, and to sync clients from that mirror (which requires no network access).The download for a full mirror is smaller than the download of two clients, whilecontaining more information.

These instructions assume that the mirror iscreated in /usr/local/aosp/mirror. The first step is to create and sync the mirroritself, which uses close to 13GB of network bandwidth and a similar amount of diskspace. Notice the --mirror flag, which can only be specified when creating a newclient:

$ mkdir -p /usr/local/aosp/mirror

$ cd /usr/local/aosp/mirror

$ repo init-u https://android.googlesource.com/mirror/manifest --mirror

$ repo sync

Once the mirror is synced, new clients can becreated from it. Note that it's important to specify an absolute path:

$ mkdir -p /usr/local/aosp/master

$ cd /usr/local/aosp/master

$ repo init-u /usr/local/aosp/mirror/platform/manifest.git

$ repo sync

Finally, to sync a client against the server,the mirror needs to be synced against the server, then the client against the mirror:

$ cd /usr/local/aosp/mirror

$ repo sync

$ cd /usr/local/aosp/master

$ repo sync

It's possible to store the mirror on a LAN serverand to access it over NFS, SSH or Git. It's also possible to store it on a removabledrive and to pass that drive around between users or between machines.

更多相关文章

  1. Android版本和兼容情况
  2. Android Studio编译release版本
  3. 【Android 应用开发】 Ubuntu 安装 Android Studio (旧版本|仅作
  4. android 应用自身检测版本并下载
  5. Android:系统信息(内存、cpu、sd卡、电量、版本)的获取
  6. 编译FFMpeg的Android版本,并整合到android studio
  7. ANDROID版本号和版本名称的重要性介绍
  8. Android版本的RSA非对称加密实现
  9. 自动批改android模拟器的imei的小程序 和 下载各个版本SDK Tools

随机推荐

  1. 【PullToRefresh 系列一基本使用方法】 A
  2. Adroid studio3.2 JNI教程
  3. Android(安卓)UI Libs之AndroidSwipeLayo
  4. android 改变线程优先级Change Thread Pr
  5. Android持久化存储总结
  6. ionic3/ionic4 要配置android ios使用一
  7. Android游戏框架
  8. 2019-02-25(android)
  9. 制作自己的android升级包(update.zip)
  10. 兼容android 9.0 明文传输(支持http请求,默