当前位置:   article > 正文

Android 9.0 源码编译Android Car Automotive_android9.0编car 模拟器

android9.0编car 模拟器

直接进入主题, 从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: 配置邮箱地址和用户名

  1. git config --global user.email "xxx@xx.com"
  2. git config --global user.name "xxx"

(2)安装curl库:(用来安装repo工具)

sudo apt-get install curl

(3)创建bin目录并且加入到PATH

  1. mkdir ~/bin
  2. PATH=~/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) 建立个存放代码的文件夹并且初始化仓库

  1. mkdir AOSP
  2. cd AOSP
  3. 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

  1. sudo  add-apt-repository  ppa:openjdk-r/ppa
  2. sudo apt-get  update
  3. sudo apt-get install openjdk-8-jdk
  4. sudo update-alternatives --config java
  5. 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启动模拟器。

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

  1. source build/envsetup.sh
  2. lunch 10
  3. emulator
emulator

直接上图

启动过程:

 

到此,Android Car Automotive编译启动完成。有兴趣的小伙伴可以学习一下Android Car Automotive

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/501633
推荐阅读
相关标签
  

闽ICP备14008679号