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||Play Store||Google Automotive App Host|
|Automotive Intel x86 Atom System Image||28||x86||✔|
|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||✔||✔|
Follow these steps to install generic system images:
- In Android Studio, select Tools > SDK Manager.
- Click the SDK Platforms tab.
- Click Show Package Details.
- Select which image(s) to download (see the preceding table for details)
Click Apply, then click OK.
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:
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:
- In Android Studio, select Tools > AVD Manager.
- Click Create Virtual Device.
- From the Select Hardware dialog, select Automotive, and then select a device. Click Next.
- Select a system image that targets Automotive, such as Android 12L (Automotive with Play Store), and click Next.
- Name your AVD and select any other options that you want to customize, then click Finish.
- From the tool window bar, select your Android Automotive OS AVD as your deployment target.
- Click Run .
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
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
and change its value.
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.
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.
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:
In Android Studio, select Run > Edit Configurations.
Select your automotive module from the list of modules in your app.
Under Launch Options > Launch, select Nothing.
Click Apply, and then click OK.