Android 9.0 源码编译Android Car Automotive

895 阅读2分钟

转自: 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:blog.csdn.net/qq_24495693… ———————————————— 直接进入主题, 从Android 9.0源码下载到编译Android Car Automotive。

  1. 楼主使用的环境: Ubuntu 16.04

硬件配置: Intel 4代 i5处理器, 硬盘 1TB, 内存 8GB.

  1. 工具配置

Android 使用git管理代码,Android 中有众多代码库, 使用repo工具来集中管理Android 中的所有git库。

(1)下载git工具

sudo apt-get install git 配置git: 配置邮箱地址和用户名

git config --global user.email "xxx@xx.com" git config --global user.name "xxx" (2)安装curl库:(用来安装repo工具)

sudo apt-get install curl (3)创建bin目录并且加入到PATH

mkdir /bin PATH=/bin:$PATH (4)下载repo工具

curl mirrors.tuna.tsinghua.edu.cn/git/git-rep… > ~/bin/repo 添加可执行权限

chmod a+x ~/bin/repo repo 初始化需要使用到Python2.7。 ubuntu自带

  1. 下载源码

使用清华源进行源码下载

(1)更改repo地址

直接在repo工具脚本中修改:替换 Google repo

REPO_URL='mirrors.tuna.tsinghua.edu.cn/git/git-rep…'

(2) 建立个存放代码的文件夹并且初始化仓库

mkdir AOSP

cd AOSP

repo init -u aosp.tuna.tsinghua.edu.cn/platform/ma… -b android-9.0.0_r8

执行完初始化命令后, 会在当前目录下生成一个.repo的掩藏文件.

repo 初始化完成后开始同步代码

repo sync 等待一段时间(几个小时),等待代码 sync完成

  1. 编译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个小时)

  1. 编译结束, 接下来启动Android Car Automotive模拟器

注意: 在刚才编译完成的终端上, 直接输入emulator启动模拟器。

如果是新终端, 需要进行如下操作,再启动模拟器

source build/envsetup.sh lunch 10 emulator emulator

image.png

直接上图

启动过程 ———————————————— 版权声明:本文为CSDN博主「qq_24495693」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:blog.csdn.net/qq_24495693…

实践过程: 1:pyton需要2的版本才可以,需要切换下版本号 2:lunch 10编译不过,lunch7 可以编译过。正常使用。