Kos*_*tas 39 android device adb logcat
如何在多个设备上同时运行logcat?"adb logcat"命令给出错误:
error: more than one device and emulator
Run Code Online (Sandbox Code Playgroud)
lev*_*501 71
使用以下-s
选项adb
:
adb -s <serialnumber>
Run Code Online (Sandbox Code Playgroud)
例
C:\Users\lel>adb devices
List of devices attached
192.168.198.101:5555 device
0123456789ABCDEF device
adb -s 0123456789ABCDEF logcat
adb -s 192.168.198.101:5555 logcat
Run Code Online (Sandbox Code Playgroud)
您可以grep
将此功能组合在一起,以获取包含它的所有行.
一个例子是System.out
例:
adb -s 192.168.198.101:5555 logcat | grep "System.out"
Run Code Online (Sandbox Code Playgroud)
Gus*_*ira 10
我认为它可能有用.我有这个脚本可以帮助我很多.它会将每个设备记录到不同的文件中.要停止记录,只需按CTRL + C.
#! /bin/bash
devices=`adb devices | grep 'device$' | cut -f1`
pids=""
for device in $devices
do
log_file="$device-`date +%d-%m-%H:%M:%S`.log"
echo "Logging device $device to \"$log_file\""
adb -s $device logcat -v threadtime > $log_file &
pids="$pids $!"
done
echo "Children PIDs: $pids"
killemall()
{
echo "Killing children (what a shame...)"
for pid in $pids
do
echo "Killing $pid"
kill -TERM $pid
done
}
trap killemall INT
wait
Run Code Online (Sandbox Code Playgroud)