Android Auto Desktop Head Unit Emulator Setup
In this article
This guide walks you through installing and configuring the Android Auto Desktop Head Unit (DHU) emulator, a developer tool that lets you run Android Auto on your computer. It's essential for testing your Android Auto apps without needing a physical car head unit. You'll need a computer running Windows, macOS, or Linux, and a recent version of Android Studio installed.
What You'll Need
- A computer with at least 8GB of RAM (16GB recommended) running Windows 10/11, macOS 12+, or a modern Linux distribution.
- Android Studio installed (version 2023.1 or later recommended).
- Android SDK Platform Tools (usually included with Android Studio).
- A USB cable (if connecting a physical Android phone) or a virtual device (AVD) created in Android Studio.
- An Android phone running Android 11 or later with the Android Auto app installed (optional, for testing with a real device).
Step-by-Step
- Launch Android Studio and open your project that targets Android Auto, or create a new project with an Automotive OS module if you're starting fresh.
- Open the SDK Manager (Tools > SDK Manager). Under the "SDK Tools" tab, ensure "Android SDK Platform-Tools" is installed. Also, verify that "Android Auto Desktop Head Unit Emulator" is listed under "SDK Tools" – if not, check the "Show Package Details" box to find it.
- Install the DHU emulator: In the SDK Manager, locate "Android Auto Desktop Head Unit Emulator" (under SDK Tools). Check the box, click "Apply", and accept the license to download it. The emulator files will be placed in your Android SDK directory, typically under
extras/google/auto. - Set up a virtual device (AVD): Open the AVD Manager (Tools > AVD Manager) and create a new virtual device. Choose a device definition like "Pixel 4" and a system image with API level 30 or higher (e.g., Android 11). Finish the setup and start the virtual device.
- Run the DHU emulator: Open a terminal (Command Prompt on Windows, Terminal on macOS/Linux) and navigate to the DHU directory. On Windows, it's usually
%LOCALAPPDATA%\Android\Sdk\extras\google\auto\desktop-head-unit. Run the executable:desktop-head-unit.exe(Windows) ordesktop-head-unit(macOS/Linux). The emulator window will open, showing a simulated car display. - Connect the virtual device: With the AVD running, the DHU emulator should automatically detect it and connect. If not, click the "Connect" button in the DHU window and select the AVD from the list. The emulator will then display the Android Auto interface.
- Configure the emulator settings: In the DHU window, click the settings gear icon. Here you can adjust screen resolution, DPI, and enable/disable features like the microphone or GPS simulation. For most testing, the default settings are fine.
- Install your app: Build your app in Android Studio (Build > Build Bundle(s) / APK(s) > Build APK(s)). Then, install it on the AVD by running
adb install path/to/your-app.apkfrom the terminal, or by dragging the APK onto the AVD window. - Launch your app on the DHU: Once installed, your app should appear in the Android Auto app launcher on the DHU emulator. Tap its icon to launch it. You can now test your app's interface and interactions.
- Test with a physical phone (optional): If you prefer to use a real phone, enable Developer Options on the phone, turn on USB debugging, and plug it into your computer. In the DHU emulator, select "Phone" instead of "AVD" and follow the prompts to authorize. The phone's Android Auto will then be mirrored on the emulator.
Common Mistakes
- Not installing the DHU package: Many users miss the step of installing the "Android Auto Desktop Head Unit Emulator" from the SDK Manager. Without it, the
desktop-head-unitexecutable won't exist. - Using an outdated Android Studio: Older versions of Android Studio may not have the DHU emulator in the SDK Manager. Update to the latest stable version.
- Forgetting to start the AVD: The DHU emulator needs a running virtual device to connect to. If you skip starting the AVD, the DHU will show a "No device connected" message.
- Incorrect SDK path: If you've customized your SDK location, the DHU files may be elsewhere. Use the SDK Manager's "SDK Tools" tab to see the exact path.
- Not enabling USB debugging on a physical phone: When using a real phone, USB debugging must be enabled in Developer Options, or the DHU won't recognize the device.
Tips
- Use a dedicated AVD: Create a separate AVD with a lower resolution (e.g., 720p) to better mimic a car display and improve performance.
- Simulate GPS: In the DHU settings, you can set a mock location to test apps that rely on navigation. This is great for map and location-based apps.
- Take advantage of the DHU's screen recording: The emulator has a built-in screen recording feature, useful for capturing bugs or demos.
- Keep your SDK and tools updated: Regularly update Android Studio and the SDK tools to ensure compatibility with the latest Android Auto features.
Troubleshooting
The DHU emulator won't start: Ensure you've installed the DHU package from the SDK Manager. If it still fails, try running it from the command line to see any error messages. On Windows, you may need to install the Microsoft Visual C++ Redistributable.
The DHU window is blank or not connecting: Make sure the AVD is running and fully booted. In the DHU, click "Connect" and manually select the AVD. If it still fails, restart both the AVD and the DHU.
App doesn't appear in the DHU: Check that your app is installed on the AVD (use adb shell pm list packages to verify). Also, ensure your app declares the necessary Android Auto intent filters in its manifest.
Performance is laggy: Close other applications, reduce the AVD resolution, and increase the RAM allocated to the AVD in the AVD Manager.
Physical phone not detected: Try a different USB cable, ensure USB debugging is enabled, and accept the RSA key prompt on the phone. Also, check that the phone isn't in "Charging only" mode.
Frequently Asked Questions
Do I need a physical car to test Android Auto? No, the DHU emulator simulates the car display, so you can test your apps entirely on your computer.
Can I use the DHU emulator on a Mac with Apple Silicon? Yes, the DHU emulator is available for macOS, including Apple Silicon. Just ensure you have the latest Android Studio version.
Is the DHU emulator free? Yes, it's part of the Android SDK and is free to use for development.
Can I test phone projection features? The DHU emulator supports core Android Auto features like media, navigation, and messaging. Some advanced features like voice assistance may be limited.
How do I update the DHU emulator? Update it through the SDK Manager, just like other SDK tools. The emulator will receive updates alongside Android Studio.
Does the DHU emulator work on Linux? Yes, it's supported on Linux, but you may need to install additional libraries like libxcb-xinerama0 on some distributions.