使用https://mirrors.tuna.tsinghua.edu.cn/help/AOSP 進行下載Android源碼python
到清華mirror下載repoandroid
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo chmod +x repo
設置更新源:git
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
由於Android的源碼愈來愈大,repo sync失敗的機率也愈來愈高。
因此咱們能夠避開使用repo sync的方式,而採用下載預下載包的方式來實現:github
wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下載初始化包 tar xf aosp-latest.tar cd AOSP # 解壓獲得的 AOSP 工程目錄 # 這時 ls 的話什麼也看不到,由於只有一個隱藏的 .repo 目錄 #查看分支 cd .repo/manifests git branch -a #選擇須要同步的版本 repo init -b android-9.0.0_r55 repo sync # 正常同步一遍便可獲得完整目錄 # 或 repo sync -l #僅checkout代碼 #加載具體模塊 repo sync platform/prebuilts/clang/host/darwin-x86
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386 sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev sudo apt-get install git-core gnupg flex bison gperf build-essential sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib sudo apt-get install libc6-dev-i386 sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4 sudo apt-get install lib32z-dev ccache
. build/envsetup.sh lunch #選擇編譯版本 make -j16 #編譯 #make -j4 2>&1 | tee build.log 保存編譯記錄 make clobber #清除
git clone https://aosp.tuna.tsinghua.edu.cn/kernel/msm.git cd msm git branch -a git checkout remotes/origin/android-goldfish-3.4
mmm development/tools/idegen/ ./development/tools/idegen/idegen.sh
Android Studio 打開android.irpmarkdown
http://blog.hsujee.com/2018/07/03/Android/Common/2018-07-03-Android源碼和內核下載編譯流程/<br/>
https://yq.aliyun.com/articles/695410
https://blog.csdn.net/su749520/article/details/82800050
https://blog.csdn.net/qq_34738528/article/details/99621444
https://blog.csdn.net/qq_35904259/article/details/61200880
https://blog.csdn.net/github_19529589/article/details/80901130curl