Android 9.0 源碼編譯Android Car Automotive

直接進入主題, 從Android 9.0源碼下載到編譯Android Car Automotive。

 

1. 樓主使用的環境: Ubuntu 16.04 

硬件配置: Intel 4代 i5處理器, 硬盤 1TB, 內存 8GB. 

 

2. 工具配置

Android 使用git管理代碼,Android 中有衆多代碼庫, 使用repo工具來集中管理Android 中的所有git庫。

(1)下載git工具

sudo apt-get install git

配置git: 配置郵箱地址和用戶名

git config --global user.email "[email protected]"
git config --global user.name "xxx"

(2)安裝curl庫:(用來安裝repo工具)

sudo apt-get install curl

(3)創建bin目錄並且加入到PATH

mkdir ~/binPATH=~/bin:$PATH

(4)下載repo工具

curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo

添加可執行權限

chmod a+x ~/bin/repo

repo 初始化需要使用到Python2.7。 ubuntu自帶

3. 下載源碼

使用清華源進行源碼下載

(1)更改repo地址

直接在repo工具腳本中修改:替換 Google repo

REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

(2) 建立個存放代碼的文件夾並且初始化倉庫

mkdir AOSP

cd AOSP

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r8

執行完初始化命令後, 會在當前目錄下生成一個.repo的掩藏文件.

repo 初始化完成後開始同步代碼

repo sync

等待一段時間(幾個小時),等待代碼 sync完成

 

4. 編譯Android Car Automotive

(1)安裝編譯所需庫,JDK

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip

安裝openjdk8

sudo  add-apt-repository  ppa:openjdk-r/ppa
sudo apt-get  update
sudo apt-get install openjdk-8-jdk

sudo update-alternatives --config java
sudo update-alternatives --config javac

(2) 設置編譯環境

source build/envsetup.sh

(3)選擇編譯平臺

此處編譯Android Car Automotive,選擇10. aosp_car_x86_64-userdebug

lunch

(4) 開始編譯

make -j8

make -jxx

-j 後的數字是編譯使用的線程數

(電腦較弱,只使用2線程編譯)

(5)編譯完成

(不同配置的電腦,編譯時長不一樣,樓主小本本編譯了11個小時)

5. 編譯結束, 接下來啓動Android Car Automotive模擬器

注意: 在剛纔編譯完成的終端上, 直接輸入emulator啓動模擬器。

如果是新終端, 需要進行如下操作,再啓動模擬器

source build/envsetup.sh
lunch 10
emulator
emulator

直接上圖

啓動過程:

 

到此,Android Car Automotive編譯啓動完成。有興趣的小夥伴可以學習一下Android Car Automotive

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章