如何在多个设备上同时运行logcat? “adb logcat”命令给出错误:
error: more than one device and emulator
答案 0 :(得分:65)
使用-s
的{{1}}选项:
adb
示例强>
adb -s <serialnumber>
您可以将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
组合起来,以获取包含它的所有行
一个例子是grep
示例:
System.out
答案 1 :(得分: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
答案 2 :(得分:0)
使用你的设备ip:
adb -s device_ip:5555