Skip to content

Set‐up Full Virtual Android Auto Head Unit Debugging

DJDoubleD edited this page Sep 14, 2024 · 3 revisions

As it can be tricky to get the Desktop Head Unit to work in combination with an Android Virtual Device, This page details the steps needed to set up a working virtual device chain for testing and debugging.
The main problem with current AVD's is that the x86_64 platform is no longer supported through the play store and automatic updates will require an update to the latest version of the app.
Following these steps should result in a working virtual device chain:

  1. Have these SDK tools installed:

    image

  2. Created a AVD using the Pixel 3 with Play Store template (constrained by current hardware...):

    image

  3. Selected the Android 13 Google Play image (started with this, other versions might work the same)

    image

  4. Booted the AVD, logged in with my test gmail, skipped all the set-up and disabled automatic updates in the play store.

  5. Downloaded and installed the latest x86_64 Android Auto apk (currently https://www.apkmirror.com/apk/google-inc/android-auto/android-auto-12-6-6432-release/android-auto-12-6-643248-release-android-apk-download/) And installed it through adb:

    adb install "<APK Download Path>\com.google.android.projection.gearhead_12.6.643248-release-126643248_minAPI26(x86_64)(nodpi)_apkmirror.com.apk"
  6. Started ReFreezer in debug mode (in my case from VsCode)
    ReFreezer needs to be running on the device first before android auto is connected in order for tracks to be able to play from the head unit. When the app is launched from the head unit directly, it uses a different entry point (not the MainActivity.java) and thus doesn't create the method channel to start the streaming server.

  7. Activated Developer Mode in the device (7 taps on build number)

  8. Activated Developer Mode in Android Auto

    • Settings => Connection Preferences => Android Auto => 7 taps on "Version"
  9. In Android Auto changed the following Developer Settings (access through the 3 dots, top right):

    • Wireless Android Auto => checked
    • Application Mode => Developer
    • Unknown Sources => checked
  10. (Optional I think) Checked in "Customise Launcher" for Android Auto that ReFreezer was listed and checked

  11. Started the Head Unit Server from Android Auto menu (access through the 3 dots, top right).

  12. Forward the server port in adb:

    adb forward tcp:5277 tcp:5277
  13. Start the DHU:

    <AndroidSDK Path>\extras\google\auto>desktop-head-unit
  14. The DHU should start and connect to the running AVD. Just followed the on screen instruction to grant the requested permissions and start ReFreezer from DHU launcher:

    image

Debugging now works through both virtual devices.

Clone this wiki locally