一,Android源码编译环境搭建
1 安装Java Development Kit (JDK)
sudo apt-get update
sudo apt-get install openjdk-8-jdk
2,确认JDK安装成功
java -version
3,安装编译所需的依赖项
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 -y
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip -y
4,下载repo工具
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
5,下载代码
mkdir android-13.0.0_r40
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-13.0.0_r40
repo sync
二,其他:
1,repo问题:
使用旧版本repo在repo init拉代码时出现如下问题:
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [Errno 110] Connection timed out
解决方案:
echo 'export REPO_URL="https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/"'>> ~/.bashrc
source ~/.bashrc
2,repo sync自动下载脚本解决断了自动下载问题:
myrepo_sync_src.sh内容:
#!/bin/sh
echo "======start repo sync======"
repo sync
while [ $? -ne 0 ]
do
echo "======sync failed, re-sync again======"
sleep 3
repo sync
done