Test using the Android Automotive OS emulator

You can use the Android Emulator to test how your app runs on Android Automotive OS.

Add system images

Before you can create Android Automotive OS virtual devices, you need to add system images through the Android Studio SDK Manager.

Add generic system images

Android Studio includes generic system images for Android Automotive OS that you can use to test your app and which you should use when taking screenshots for the Play Store.

Name API Level Architecture Google Play Services Google Play Store Google Automotive App Host
Automotive Intel x86 Atom System Image 28 x86 (Not available on any production cars at this API level)
Automotive with Play Store Intel x86 Atom System Image 29 x86
Automotive with Play Store Intel x86 Atom_64 System Image 30 x86
Automotive with Play Store ARM 64 v8a System Image 32 ARM
Automotive with Play Store Intel x86 Atom_64 System Image 32 x86
Android Automotive with Google APIs ARM 64 v8a System Image 33 ARM
Android Automotive with Google APIs Intel x86 Atom_64 System Image 33 x86

Follow these steps to install generic system images:

  1. In Android Studio, select Tools > SDK Manager.
  2. Click the SDK Platforms tab.
  3. Click Show Package Details.
  4. Select which image(s) to download (see the preceding table for details)
  5. Click Apply, then click OK.

    List of SDK Platform components a generic system image
        selected.

Add system images from OEMs

You can also add OEM-specific system image for the GM, Honda, Polestar, Volvo, and others. Please follow the steps on the OEM developer sites:

In alphabetic order:

  1. GM
  2. Honda
  3. Polestar
  4. Volvo

Create a car AVD and run the emulator

Follow these steps to create an Android Virtual Device (AVD) that represents an Android Automotive OS vehicle and then use that AVD to run the emulator:

  1. In Android Studio, select Tools > AVD Manager.
  2. Click Create Virtual Device.
  3. From the Select Hardware dialog, select Automotive, and then select a hardware profile. Click Next.
  4. Select a system image that targets Automotive, such as Android 12L (Automotive with Play Store), and click Next.
  5. Name your AVD and select any other options that you want to customize, then click Finish.
  6. From the tool window bar, select your Android Automotive OS AVD as your deployment target.
  7. Click Run Run icon.

Use bundled hardware profiles

When creating an AVD, you can use the following hardware profiles that are bundled with Android Studio:

Name Resolution Availability Compatibility
Automotive (1024p landscape) 1024x768 Android Studio System images with the Play Store
Automotive (1080p landscape) 1080x600 Android Studio System images without the Play Store
Automotive Portrait 800x1280 Android Studio Canary System images without the Play Store

Create a hardware profile

If you'd like to test hardware configurations other than those covered by the bundled hardware profiles, you can also create a hardware profile for use with the Android Automotive OS emulator. Do this by selecting Android Automotive as the device type in the creation flow. Custom hardware profiles are only compatible with system images that don't include the Play Store.

Use the emulator's extended controls

In addition to many of the standard extended controls available in other Android emulators, there are some extended controls made specifically for the Android Automotive OS emulator.

Emulate hardware state

Beyond sensors such as accelerometers and gyroscopes that can be read using the standard Android APIs when available, additional hardware properties unique to vehicles are communicated over the Vehicle Hardware Abstraction Layer (VHAL). These properties are modeled by the VehiclePropertyIds class.

While the emulator is running, you can modify the values of these properties from the Car data feature of the extended controls. For example, to set the current speed of the vehicle, you can find the property for speed (VehiclePropertyIds.PERF_VEHICLE_SPEED) and change its value.

The

Simulate driving

To simulate driving, you should set the Car speed to a non-zero value and Gear to something other than P (Park). To simulate a parked state, all that is necessary is to set the Gear to P (Park). This can be done either by using the sliders and selectors under the Car sensor data tab or by modifying the VHAL properties as described in the prior section.

The

Test rotary input

In addition to a touchscreen, some Android Automotive OS vehicles come equipped with a rotary controller, which relies on the same focus APIs as keyboard navigation to let users navigate your app without touching the screen. You can use the Car rotary tool within the extended controls to test your app's support for rotary input.

The

Edit your run configurations for media apps

Media apps on Automotive OS apps are different than other Android apps. Android Automotive OS interacts with your media app using explicit intents and by sending calls to your media browser service.

To test your app, verify that your app has no launch activity in its manifest, and then prevent your automotive module from launching with an activity by completing the following steps:

  1. In Android Studio, select Run > Edit Configurations.

    The Run/Debug Configurations dialog box.

  2. Select your automotive module from the list of modules in your app.

  3. Under Launch Options > Launch, select Nothing.

  4. Click Apply, and then click OK.