2

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?

1
  • 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
    May 1, 2015 at 16:43

1 Answer 1

1

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

$ which adb
/usr/bin/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
1
  • 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
    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 .