11

TL;博士

从源代码构建 Android Automotive 后,我该如何

  1. 运行汽车模拟器?
  2. 将 CarService 和相关软件包“安装”到设备上?

细节

我正在尝试从源代码构建Android Automotive。我可以使用以下命令成功构建它:

$ repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r11 $ source build/envsetup.sh $ lunch car_emu_x86_64-userdebug $ make -j8 V=1 &>> make.log

我的问题是如何运行模拟器?在谷歌搜索并浏览了一些stackoverflow帖子之后,我遇到了这个:

首先,我在命令行中设置了一个环境变量(模拟器使用它来确定要启动哪个模拟器)

export ANDROID_PRODUCT_OUT=/path/to/build_root

接下来,我创建了一个文件car-emulator.sh并将其放入其中(构建是在 Ubuntu 机器上完成的)

#!/usr/bin/env bash

ANDROID_BUILD_OUT=/path/to/build_root/out
PREBUILT=/path/to/build_root/prebuilts
EMULATOR_OUT=${ANDROID_BUILD_OUT}/target/product/car-x86_64

${PREBUILT}/android-emulator/linux-x86_64/emulator \
    -sysdir ${EMULATOR_OUT} \
    -system ${EMULATOR_OUT}/system.img \
    -ramdisk ${EMULATOR_OUT}/ramdisk.img \
    -data ${EMULATOR_OUT}/userdata.img \
    -kernel ${PREBUILT}/qemu-kernel/x86_64/kernel-qemu \
    -scale 0.7 \
    -memory 512 \
    -partition-size 1024

我还尝试将相关的(darwin-x86_64)文件从构建机器下载到我的 Mac 笔记本电脑并尝试在那里运行。模拟器启动但立即崩溃,并带有巨大的本机堆栈跟踪。

我的问题的下一部分是如何在设备上安装此映像?我看到 CarService.apk 已经生成。在设备上安装此 APK 是否足以使其工作?还是应该将 CarService 和相关包作为需要完整刷新的系统映像的一部分?

4

2 回答 2

3

This is how I got it to work on Android 8.1.0 branch OPM5.171019.017:

$ source ./build/envsetup.sh
$ lunch aosp_car_x86_64-eng
$ emulator

Followed by the below output on the terminal:

emulator: WARNING: system partition size adjusted to match image file (2562 MB > 200 MB)

emulator: WARNING: data partition size adjusted to match image file (550 MB > 200 MB)

warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]

warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]

And the android emulator display shows up booting android automotive. I would recommend you try building the engineering version if the above solution does not work in userdebug mode. Please share the stack trace for further analysis.

About the second part of your question. I think you are mixing up android auto with android automotive.

Android Auto is just an app and can be deployed/setup using an APK and some minor tweaking, while Android Automotive is a customized version of android designed specifically for the automotive industry with its own set of system applications. Therefore, it cannot be simply deployed on a device by just installing an APK.

于 2018-05-08T09:29:41.910 回答
2

这是我的PC环境,可以运行Android Car Emulator Ubuntu 16, 16G Ram, 1T Disk

$ repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r39
$ source build/envsetup.sh
$ lunch car_emu_x86_64-userdebug
$ make -j8
$ emulator 

然后Android模拟器启动如下。

安卓模拟器

于 2019-05-14T02:11:34.557 回答