Skip to content

Capturing Logs

Oscar Cardenas edited this page Oct 13, 2026 · 2 revisions

A log shows what failed. You can capture a log in two ways. Option A uses the app and needs no computer. Option B uses adb on a computer. Only Option B also records the Android Auto side of the connection.

Which option do I need?

  • Option A is enough for most problems on the device that runs Open Headunit. Examples are a black screen, bad video, bad audio and a connection that drops.
  • Option B is necessary when we must see what Android Auto did. This includes every Self Mode problem and most wireless connection problems.

On Android 13 and newer, an app can read only its own log lines. Thus the export from the app cannot contain the Android Auto lines. Only adb can record them.

If you are not sure, do both options. Do Option A on the device that runs Open Headunit. Do Option B on the phone.

Which device gets which log?

Your setup Device that runs Open Headunit Phone that runs Android Auto
A head unit or a tablet. The phone connects over WiFi or USB. Option A Option B
Self Mode. Open Headunit and Android Auto run on the same phone. Option B on that phone. Add the Open Headunit number in step 4. The same phone

Start each capture before you tap the WiFi button or the USB button in Open Headunit. Let the problem continue for approximately one minute. Then stop the capture.

Option A: Export from the app

  1. Open Open Headunit.
  2. Go to Settings.
  3. Select the Advanced tab at the top.
  4. Scroll down to the Debug section.
  5. Tap Log Level.
  6. Select Verbose. Do not select Silent, because it stops all logs.
  7. Tap Start Capturing Logs. The row then shows Stop Capturing Logs.
  8. Do the steps that cause the problem.
  9. Immediately after the problem, tap Export Logs. The Logs Exported dialog shows the path of the file.
  10. Tap Share.
  11. Send the HUR_Log_*.txt file.

Read these two notes before you start:

  • Export the log immediately after the problem. The capture holds a maximum of 16 MB. When it is full, the app deletes the oldest lines. An export one hour later can be without the lines of the problem.
  • Android can ask you to allow access to the device logs. If it does, allow access in less than 10 seconds. After 10 seconds, the export stops and shows "Failed to export logs".

You can also find Export Logs during projection. Open the Android Auto exit dialog, then go to Quick Settings.

Option B: Capture with adb

The setup takes approximately 10 minutes and you do it one time. After the setup, a capture needs only a small number of commands.

The capture keeps only the parts of the phone that we need: Android Auto, Bluetooth and WiFi. Thus the file is small, and it does not contain your other apps.

The filter needs Android 12 or newer on the phone. For Android 11 or older, see the end of this page.

1. Install the platform tools on your computer

Windows:

  1. Download SDK Platform Tools for Windows from https://developer.android.com/tools/releases/platform-tools.
  2. Unzip the file to C:\platform-tools.
  3. Open that folder in File Explorer.
  4. Click the address bar.
  5. Type cmd and push Enter. A Command Prompt window opens in that folder.

macOS: Run brew install --cask android-platform-tools. If you do not use Homebrew, do these steps:

  1. Download the macOS zip from the same page.
  2. Unzip the file.
  3. In Terminal, use cd to go into the folder.

Linux: On Debian or Ubuntu, run sudo apt install adb. On other distributions, install the equivalent package.

On Windows, do not use PowerShell. PowerShell changes the commands below and saves the file in a format that is hard to search. Type all the commands in the Command Prompt window. On macOS and Linux, type the commands in Terminal.

2. Turn on USB debugging on the phone

  1. Go to Settings -> About phone.
  2. Tap Build number seven times. The phone then tells you that you are a developer.
  3. Go to Settings -> System -> Developer options.
  4. Turn on USB debugging.

3. Connect the phone and make sure that the computer sees it

  1. Connect the phone to the computer with a USB cable.

  2. Run this command:

    adb devices
    
  3. On the phone, a dialog asks you to allow USB debugging from this computer. Select "always allow".

  4. Accept the dialog.

The command then shows your phone with the word device. If it shows unauthorized, you did not accept the dialog yet.

Important for Self Mode: do not touch the cable during the capture

Android Auto stops a Self Mode session each time the USB port of the phone changes state. Any cable that you connect or disconnect causes this. This is how Android Auto works, not how the app works. Thus, if you connect the cable during the session, the session that you want to record stops.

Connect the cable before you start Self Mode. Do not touch the cable until the capture is complete.

If the phone has Android 11 or newer, you can use Wireless debugging and no cable. It is in the same Developer options screen:

  1. Turn on Wireless debugging.
  2. Tap Pair device with pairing code. The phone shows an IP address, a port and a six digit code.
  3. On the computer, run adb pair with the IP address and port that the phone shows. For example: adb pair 192.168.1.50:37123
  4. Type the six digit code.
  5. Look at the main Wireless debugging screen. It shows the IP address and a different port.
  6. Run adb connect with that IP address and port. For example: adb connect 192.168.1.50:41234

4. Find the Android Auto number

Each app on the phone has a number, its user id. The capture uses these numbers to keep only the lines that we need. The Android Auto number is different on each phone.

  1. Run this command:

    adb shell pm list packages -U com.google.android.projection.gearhead
    
  2. The command shows a line like package:com.google.android.projection.gearhead uid:10234. Write down the number after uid:.

  3. Self Mode only: Open Headunit runs on the same phone, so also find its number. Run this command and write down the number after uid::

    adb shell pm list packages -U com.andrerinas.headunitrevived
    

If a command shows nothing, that app is not installed on this phone.

5. Start the capture

  1. Write the second command below with your numbers. Replace 10234 with the Android Auto number from step 4.

  2. Self Mode only: Add the Open Headunit number after the Android Auto number. Use a comma and no spaces, for example --uid=10234,10456,1000,1002,1010.

  3. Run the two commands:

    adb logcat -c
    adb logcat -b main -b system -b events -b crash -v threadtime --uid=10234,1000,1002,1010 > phone-log.txt
    

    The first command removes the old lines. The second command starts the capture. The window then shows no change. This is correct, because the command writes to the file.

  4. Do the steps that cause the problem.

  5. After the problem occurs, wait approximately one minute.

  6. Push Ctrl+C. The capture stops.

The numbers after --uid are these. The file gets nothing else from the phone.

Number What it is
Your number from step 4 Android Auto. For Self Mode, also Open Headunit.
1000 The Android system. It decides which WiFi network the phone connects to.
1002 Bluetooth
1010 The WiFi helper programs, for example wificond

6. Attach the file

The file phone-log.txt is in the folder where you ran the commands.

  1. Attach phone-log.txt to your issue or discussion.
  2. If you also did Option A, attach the Open Headunit log too.

GitHub accepts a maximum of 25 MB for each file. If a file is larger, zip it first.

What is in the log

The filtered log from step 5 contains only Android Auto, the Android system, Bluetooth and WiFi. It still contains these items:

  • The names of WiFi networks near you.
  • The name of your phone.
  • The names of your paired Bluetooth devices.

On Android 11 or older, the log contains all of the phone, and also the names of the apps on it.

If you remove lines by hand, the log becomes useless to us. Attach the log as a file. Do not paste it into a comment. If you do not want to share this data, do not send the log.

If the capture does not work

  • adb devices shows no device. Change the USB mode of the phone from "Charging" to File transfer. On Windows, also install the Google USB Driver or the USB driver from the maker of your phone.

  • adb devices shows unauthorized. You did not accept the dialog on the phone. Do these steps:

    1. Run adb kill-server.
    2. Disconnect the cable.
    3. Connect the cable again.
    4. Accept the dialog on the phone.
  • adb devices shows offline. Disconnect the cable and connect it again. Then run adb devices again.

  • logcat does not accept --uid. The filter needs Android 12 or newer. On an older phone, use this command in step 5 instead: adb logcat -b main -b system -b events -v threadtime > phone-log.txt

  • pm list packages -U shows no uid:. Run this command, and use the number after userId=: adb shell "dumpsys package com.google.android.projection.gearhead | grep -m1 userId"

  • The file is empty or almost empty. Do these checks:

    1. Make sure that the Android Auto number is in --uid, with commas and no spaces.
    2. Make sure that you used Command Prompt, not PowerShell.

    Some ROMs from device makers also limit the log service. This occurs mostly on old phones and head units. The cause is the device, not the app, and the app cannot prevent it.

Clone this wiki locally