-
-
Notifications
You must be signed in to change notification settings - Fork 195
Capturing Logs
A log is the only way to tell what actually failed. This page shows both ways to capture one: from inside the app, which takes a minute and needs no computer, and with adb from a computer, which is the only way to also capture Android Auto's own side of the conversation.
- Export from the app is enough for most reports: black screen, video glitches, audio problems, a connection that drops on a head unit.
-
adb from a computer is needed whenever the question is what Android Auto itself decided, and that includes every Self Mode report. On Android 13 and newer an app can only read its own log lines, so the in-app export physically cannot contain Android Auto's lines. Only
adbcan.
If you are not sure, do the adb one. It contains everything the app export contains, plus the rest.
- Open Open Headunit, go to Settings, and switch to the Advanced tab at the top.
- Scroll down to the Debug section.
- Tap Log Level and choose Verbose. Do not choose Silent, it turns logging off entirely.
- Tap Start Capturing Logs. The row changes to Stop Capturing Logs while it records.
- Reproduce the problem.
- Straight afterwards, tap Export Logs. A dialog says Logs Exported and shows the full path of the file. Tap Share and send the
HUR_Log_*.txtfile.
Two things to know:
- Export immediately after the failure. A capture is capped at 16 MB and older lines are thrown away as it fills, so an export an hour later may no longer contain the moment it broke.
- If Android asks to allow access to device logs, allow it within a few seconds. The export gives up after 10 seconds and shows "Failed to export logs".
While projecting you can also reach Export Logs from the Android Auto exit dialog, under Quick Settings.
This is a one time setup of about ten minutes. After that a capture takes two commands.
-
Windows: download SDK Platform Tools for Windows from https://developer.android.com/tools/releases/platform-tools, and unzip it to
C:\platform-tools. Open that folder in File Explorer, click the address bar, typecmdand press Enter. That gives you a Command Prompt already in the right folder. -
macOS:
brew install --cask android-platform-tools, or download the macOS zip from the same page and unzip it, thencdinto the folder in Terminal. -
Linux:
sudo apt install adbon Debian or Ubuntu, or the equivalent package on your distribution.
On Windows, every command below is typed in that Command Prompt window. On macOS and Linux, type them in Terminal.
- Settings -> About phone, tap Build number seven times until it says you are now a developer.
- Go back to Settings -> System -> Developer options and turn on USB debugging.
Plug the phone into the computer, then run:
adb devices
The phone shows a dialog asking to allow USB debugging from this computer. Tick "always allow" and accept it. The command should then list your phone with the word device next to it. If it says unauthorized, the dialog was not accepted yet.
Android Auto ends a Self Mode session whenever the phone's USB port changes state, whatever you plug in or unplug. This is Android Auto's own behaviour, not the app's, so plugging the cable in halfway through will kill the very session you are trying to record.
Plug the cable in before you start Self Mode, and leave it completely alone until the capture is finished.
If your phone runs Android 11 or newer you can avoid the cable entirely with Wireless debugging, in the same Developer options screen:
- Turn on Wireless debugging and tap Pair device with pairing code. It shows an IP address, a port and a six digit code.
- On the computer:
adb pair 192.168.1.50:37123using the numbers it shows, then type the code. - Then connect using the IP and port from the main Wireless debugging screen, which is a different port:
adb connect 192.168.1.50:41234.
Windows users: use Command Prompt, not PowerShell. PowerShell saves the file in a format that is hard to search afterwards.
adb logcat -c
adb logcat -b all -v threadtime > ohu-log.txt
The first command clears out old lines so the file starts clean. The second one starts recording and looks like it has frozen. That is correct, it is writing to the file.
If your device rejects -b all, use this instead:
adb logcat -b main -b system -b events -v threadtime > ohu-log.txt
ohu-log.txt is in the folder you ran the command from. Attach it to your issue or discussion as a file. GitHub accepts up to 25 MB per attachment, so zip it first if it is larger.
An adb capture records the whole phone, not just Open Headunit, so it can contain your WiFi network names, your phone's name, and the names of apps installed on it. There is nothing useful you can strip out by hand without breaking it. Attach it as a file rather than pasting it into a comment, and skip it entirely if you would rather not share that.
-
adb deviceslists nothing. Change the phone's USB mode from "Charging" to File transfer. On Windows, install the Google USB Driver or your phone maker's USB driver. -
It says
unauthorized. The allow dialog on the phone was not accepted. Runadb kill-server, unplug, plug back in, and accept it. -
It says
offline. Unplug and replug, then runadb devicesagain. - The file is empty. Some manufacturer ROMs, mostly on older phones and head units, restrict the logging service. That is the device, not your Android version and not the app, and there is no way around it from the app side.