一、安装curl及git工具
1.sudo apt-get install curl
2.sudo apt-get install git-core
二、下载google android的repo
1.curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ./
2.cp repo ~/bin/repo
3.chmod a+x ~/bin/repo
三、初始化repo并选择分支
1.repo init -u https://android.googlesource.com/platform/manifest
2.repo init -u https://android.googlesource.com/platform/manifest -b android-4.2_r1
四、下载源码
repo sync
注意事项:vim /etc/hosts添加如下:
74.125.31.82 www.googlesource.com
74.125.31.82 android.googlesource.com
203.208.46.172 cache.pack.google.com
59.24.3.173cache.pack.google.com