Posted by Josh Gordon, Developer Advocate
Today we’re releasing the Desktop Head Unit (DHU), a new testing tool for Android Auto developers. The DHU enables your workstation to act as an Android Auto head unit that emulates the in-car experience for testing purposes. Once you’ve installed the DHU, you can test your Android Auto apps by connecting your phone and workstation via USB. Your phone will behave as if it’s connected to a car. Your app is displayed on the workstation, the same as it’s displayed on a car.
|The DHU runs on your workstation.||Your phone runs the Android Auto companion app.|
Now you can test pre-released versions of your app in a production-like environment, without having to work from your car. With the release of the DHU, the previous simulators are deprecated, but will be supported for a short period prior to being officially removed.
You’ll need an Android phone running Lollipop or higher, with the Android Auto companion app installed. Compile your Auto app and install it on your phone.
Install the DHU
Install the DHU on your workstation by opening the SDK Manager and downloading it from
Extras > Android Auto Desktop Head Unit emulator. The DHU will be installed in the
Running the DHU
Be sure your phone and workstation are connected via USB.
- Enable Android Auto developer mode by starting the Android Auto companion app and tapping on the header image 10 times. This is a one-time step.
- Start the head unit server in the companion app by clicking on the context menu, and selecting “Start head unit server”. This option only appears after developer mode is enabled. A notification appears to show the server is running.
- On your workstation, set up port forwarding using ADB to allow the DHU to connect to the head unit server running on your phone. Open a terminal and type
adb forward tcp:5277 tcp:5277. Don’t forget this step!
- Start the DHU.
cd <sdk>/extras/google/auto/On Linux or OSX:
|Start the head unit server in the Android Auto companion app before starting the DHU on your workstation.||You’ll see a notification when the head unit server is running.|
At this point the DHU will launch on your workstation, and your phone will enter Android Auto mode. Check out the developer guide for more info. We hope you enjoy using the DHU!