直接进入主题, 从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/'

Android 9.0 源码编译Android Car Automotive_第1张图片

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

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

Android 9.0 源码编译Android Car Automotive_第2张图片

执行完初始化命令后, 会在当前目录下生成一个.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/ppasudo apt-get  updatesudo apt-get install openjdk-8-jdksudo update-alternatives --config javasudo update-alternatives --config javac

(2) 设置编译环境

source build/envsetup.sh

Android 9.0 源码编译Android Car Automotive_第3张图片

(3)选择编译平台

此处编译Android Car Automotive,选择10. aosp_car_x86_64-userdebug

lunch

Android 9.0 源码编译Android Car Automotive_第4张图片

Android 9.0 源码编译Android Car Automotive_第5张图片

(4) 开始编译

make -j8

make -jxx

-j 后的数字是编译使用的线程数

(电脑较弱,只使用2线程编译)

Android 9.0 源码编译Android Car Automotive_第6张图片

(5)编译完成

(不同配置的电脑,编译时长不一样,楼主小本本编译了11个小时)

Android 9.0 源码编译Android Car Automotive_第7张图片

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

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

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

source build/envsetup.shlunch 10emulator
emulator

Android 9.0 源码编译Android Car Automotive_第8张图片

直接上图

启动过程:

Android 9.0 源码编译Android Car Automotive_第9张图片

Android 9.0 源码编译Android Car Automotive_第10张图片

 

Android 9.0 源码编译Android Car Automotive_第11张图片

Android 9.0 源码编译Android Car Automotive_第12张图片

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

更多相关文章

  1. Android 2.2.2到Android 4.2.2源码下载地址
  2. Android 之 ImageSwitch图片转换器
  3. SQLiteDatabase 启用事务源码分析
  4. Android下图片或按钮等可拖动到任意位置的效果实现源码
  5. Android查看源码
  6. 【Android 应用开发】Ubuntu 下 Android Studio 开发工具使用详
  7. android 处理图片工具
  8. android关于getLayoutParams()方法源码译文(部分)
  9. android ImageView 显示本地图片

随机推荐

  1. JQuery UI自动完成(1.8)滚动
  2. jQuery Ui Draggable在移动端浏览器不起
  3. jquery简单笔记(1)
  4. ajax with select tag rails 4
  5. 加载函数加载页面但不能对数据执行任何操
  6. jQuery-对Select的操作集合
  7. 用jquery技术实现table的奇数行变色
  8. JQuery自动完成功能不会显示所有结果
  9. 在发出xml Ajax请求时获取错误412
  10. jQuery向父级元素最前面添加元素—prepen