Android log automatic filter
When I leave eclipse during android development, will it be annoying to capture logs?
Is it even more annoying to capture logs of a process?
The general operation process is as follows:
Step 1
Adb shell
$ Ps
Then you can see a lot of processes and find the process you want. It is very painful to see the process id.
Step 2
$ Logcat-v time | grep pid
Figure saves time by writing a simple script that can run under the terminal of ubuntu or mac.
The content is as follows:
#! /Bin/bash # get pid of protectserviceps_grep_res =$ (adb shell ps | grep com. xxx. xxx) echo $ ps_grep_respid = $ (echo $ ps_grep_res | awk '{print $2}') echo "pid =" $ pid # print logcatadb logcat-v time | grep $ pid
Copy the preceding content to a text file. Rename the package name after grep to xx. sh and grant the execution permission.
Then you can happily capture logs on the command line.
The execution method is simple./xx. sh
It's too lazy. It's easy. No picture. No truth. Believe it or not. I believe it.