-
虚拟机安装
ubuntu12.04安装 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/12.04/
注意:vmware需选择最新版将会找不到系统,选择12版本解决。 -
下载源码
cd android4.4/
ls
reoomkdir ~/bin
PATH=~/bin: P A T H m k d i r / b i n P A T H = / b i n : PATH mkdir ~/bin PATH=~/bin: PATHmkdir /binPATH= /bin:PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
sudo apt-get install curl
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
repo
repo git config --global user.name “Your Name”
git config --global user.email "you@example.com"
sudo apt-get install git
ls
git config --global user.name “Your Name”
git config --global user.email "you@example.com"
repo init -u https://android.googlesource.com/platform/manifest
初始化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 init -u https://android.googlesource.com/platform/manifest -b android-4.0.3_r1
会报错误 异常为
error: The requested URL returned error: 406 while accessing https://android.googlesource.com/platform/cts/info/refs
fatal: HTTP request failed
error: Cannot fetch platform/cts
error: Failed to connect to 2404:6800:4008:c01::52: Network is unreachable while accessing https://android.googlesource.com/platform/external/bzip2/info/refs
fatal: HTTP request failed
error: Failed to connect to 2404:6800:4008:c01::52: Network is unreachable while accessing https://android.googlesource.com/platform/external/checkpolicy/info/refs
fatal: HTTP request failed
解决方法
-
浏览器登录https://android.googlesource.com/new-password,并用gmail帐号登录;
-
点击网页上的“允许访问”,得到类似
machine android.googlesource.com login git-jacky.rg4.net password 1/dkRiGEvvC8o8Pgg-GsM2AbMNS_32-U0Pf0_VWkYogIA
machine android-review.googlesource.com login git-jacky.rg4.net password 1/dkRiGEvvC8o8Pgg-GsM2AbMNS_32-U0Pf0_VWkYogIA
3. 把上面那段信息追加到~/.netrc文件结尾(请检查当前用户的权限, 如果不存在此文件则自己新建一个);
-
下载地址的URI更改为https://android.googlesource.com/a/platform/manifest(中间加上了“/a”)。
-
repo init -u https://android.googlesource.com/a/platform/manifest -b android-4.0.3_r1
-
repo sync
国内镜像
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.4.2_r2.0.1
编译软件安装
sudo apt-cache search openjdk
sudo apt-get install -y git git-core flex bison gperf build-essentialgnupg g++-multilib zip curl zlib1g-dev zlib1g-dev:i386 gcc-multilib xsltprocunzip m4 x11proto-core-dev tofrodos python-markdown dpkg-dev ccache
sudo apt-get install libncurses5-dev:i386 libx11-dev:i386libreadline6-dev:i386 libgl1-mesa-dev libc6-dev-i386 lib32z-dev libxml2-utils lib32ncurses5-devlibx11-dev libsdl1.2-dev libesd0-dev
//然后执行下面这条命令更新安装好的可更新的软件包:
sudo apt-get update