I am trying do do some stuff the Android Device Monitor does on command line in a script. As far as I found out you cannot use the monitor from command line without GUI. My approach is to capture (adb) commands the monitor sends to the emulator and then use these commands directly. I already tried logcat without results (tried with adb push -> nothing logged). I also tried wireshark (usb sniffing) but that didn't work either. (too much information, maybe I did something wrong)

If anyone is interested: I am trying to do method profiling and save the trace file for further analysis. Btw. does anybody know why they say traceview and dmtracedump is deprecated?

  • Adb remote commands are done using a noninteractive shell. so normal logging isn't done. There should be some way of getting noninteractive shells to log, but a quick mobile Google search didn't show anything.
    – cde
    Commented May 1, 2015 at 16:43

1 Answer 1


If You work on Linux machine, here is a way:

$ which adb
$ sudo mv /bin/adb /bin/adb2
$ sudo sh -c "echo 'echo $* > /tmp/log_adb_cmd.txt\n/bin/adb2 $*' > /bin/adb"
$ sudo chmod +x /bin/adb
$ cat /bin/adb
echo $* > /tmp/log_adb_cmd.txt
/bin/adb2 $*

Run Android Device Monitor...and don't forget to reverse operation:

$ sudo mv /bin/adb2 /bin/adb
  • That's a really cool approach. But it seems like method tracing is not done over adb but it's actually the answer to my question.
    – Martin
    Commented May 4, 2015 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .