Android 下载说明,https://source.android.com/source/downloading.html
Android 版本查看,https://android.googlesource.com/platform/manifest/+refs
------------------------------------------
修改 hosts 文件(添加相关 IP)
Linux, /etc/hosts
Windows, C:\WINDOWS\system32\drivers\etc\hosts
------------------------------------------
sudo apt-get install curl
mkdir ~/android
curl http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo > ~/android/repo
chmod a+x ~/android/repo
export PATH=~/android:$PATH
cd ~/android
./repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r1
sh -c "echo \"
#!/bin/bash
result=1
while [ $result -ne 0 ]
do
echo \"========== start repo sync ==========\"
./repo sync -j16
result=$?
sleep 1
done\" > ~/android/src_sync"; chmod a+x ./src_sync; ~/android/src_sync;
sudo sysctl -w net.ipv4.tcp_window_scaling=0
~/android/src_sync
调用 src_sync 时,出现“fatal: '../platform/abi/cpp.git' does not appear to be a git repository”,
(参考 http://zxquiet.iteye.com/blog/1470991 和 http://bbs.csdn.net/topics/380254094)
sed -i "s/fetch=\"..\"/fetch=\"git:\/\/Android.git.linaro.org\/\"/g" ~/android/.repo/manifest.xml
~/android/src_sync