:warning: This will enable tracing permanently. These instructions are well suited for tools managing adb lifecycle (like Android Studio). Once done, it is recommended to undoing the changes made here and then restarting adb via
adb kill-server ; adb server
.
Add the following line to ~/.bashrc
(.zshrc on MacOS 10.15+:W ).
ADB_TRACE=all
Add the global variable via the System Properties
window. In the Advanced
tab, click on Environment Variables
. Add the Variable/ Value to the User variables
list. Alternatively, you can bring up the same window by searching for "Edit Environment Variables".
Shutdown adb server via command adb kill-server
. Close the current terminal, open a new one, and start adb server via adb server
.
The log files are located in $TMPDIR
which is almost always /tmp
. Log files are created on a per uid basis, adb.<UID>.log
.
The log files are located in %TEMP%
which is often C:\Users\<USERNAME>\AppData\Local\Temp
. The filename is always adb.log
.
Device-side (adbd) debugging is best accomplished from a post-mortem standpoint, because real-time debugging is impossible given the fact that adb itself is the underlying debugging channel.
Device logs tend to be noisy so reproduce the problem as soon as possible, collect the logs and turn tracing off.
$ adb shell setprop persist.adb.trace_mask 1 $ adb shell pkill adbd
adb pull
and turn off tracing$ adb shell sargo:/ # cd /data/adb sargo:/data/adb # ls -al total 23 drwx------ 2 root root 3488 2022-02-08 18:04 . drwxrwx--x 49 system system 4096 2022-01-18 12:13 .. -rw------- 1 root root 8521 2022-02-08 18:05 adb-2022-02-08-18-04-49-18527
From the host: $adb pull /data/adb/adb-2022-02-08-18-04-49-18527
You may run into errors either during adb shell
or adb pull
. Make sure you are running as root.
$ adb shell setprop persist.adb.trace_mask 0 Failed to set property 'persist.adb.trace_mask' to '0'. See dmesg for error reason. $ adb root $ adb shell setprop persist.adb.trace_mask 0