Android源码下载
1.配置好環(huán)境:我這里配置的是WSL
?2.下載aosp-latest.tar,并放到工程路徑下解壓(aosp-latest.tar是每月更新的初始化包)
PS:120個(gè)G!!!!一定要準(zhǔn)備足夠大容量的內(nèi)存空間
3.進(jìn)入工程路徑,執(zhí)行解壓命令:
tar -xvf aosp-latest.tar完成后,如下:
4.配置repo命令
mkdir ~/bin PATH=~/bin:$PATH curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o ~/bin/repo chmod a+x ~/bin/repo5.配置好repo后,再修改下載源(我們這里用的是清華源)
//找到下面這行 REPO_URL = 'https://gerrit.googlesource.com/git-repo' //改為下面 REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'6.在解壓后的文件夾下執(zhí)行命令
repo initPS:1)如果出現(xiàn)錯(cuò)誤:“Command 'repo' not found, but can be installed with:sudo apt install repo”解決方法:執(zhí)行如下兩條命令,即設(shè)置環(huán)境變量
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc export PATH=$PATH:$HOME/bin2)如果出現(xiàn)錯(cuò)誤“fatal: unable to access 'http://aosp.tuna.tsinghua.edu.cn/platform/manifest/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
manifests: sleeping 4.0 seconds before retrying
fatal: unable to access 'http://aosp.tuna.tsinghua.edu.cn/platform/manifest/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
fatal: cannot obtain manifest http://aosp.tuna.tsinghua.edu.cn/platform/manifest”
解決方法:執(zhí)行如下命令
先執(zhí)行g(shù)it config --global http.sslverify false 再重新repo init3)如果出現(xiàn)如下錯(cuò)誤:
解決方法:
1)檢查自己是否安裝有python python --version2)如果沒有python,安裝python2或者python3,如果安裝python3,把下面命令中對(duì)應(yīng)的python2改成python3即可 sudo apt install python2 sudo ln -s /usr/bin/python2 /usr/bin/python2)如果之前安裝過,執(zhí)行命令: sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 17.解決完成以后,執(zhí)行命令:
repo syncPS:如果出現(xiàn)錯(cuò)誤:error: .repo/manifests/: contains uncommitted changes
解決方法:進(jìn)入到.repo/manifests目錄下,執(zhí)行g(shù)it status查看一下哪些文件存在Changes not staged for commit,然后用git checkout -- +文件取消變化,再退到工程目錄下執(zhí)行repo sync
如果執(zhí)行g(shù)it checkout或者git clean -f -d都沒有用,git status以后還是有uncommitted changes,只能提交了,提交方法如下:
??7.配置安卓編譯環(huán)境--jdk
sudo apt-get update sudo apt-get install openjdk-8-jdk8.安裝安卓編譯依賴環(huán)境
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 ccache9.好了,安卓源碼和編譯環(huán)境就配置好了
ENJOY YOURSELF!!!
總結(jié)
以上是生活随笔為你收集整理的Android源码下载的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android开发 无线Wifi+Wif
- 下一篇: android sina oauth2.