我也一直面临同样的问题.在一些挖掘中,发现该问题已经是
reported,可能很快就会出现.使用以下
script作为断开连接问题的变通方法修复 –
#!/bin/bash
cat << EOF
###########################################################
# Workaround adb disconnecting issue on macOS Sierra
#
# More info:
# https://code.google.com/p/android/issues/detail?id=219085
# credits to: hans...@meetme.com,vs...@google.com
###########################################################
EOF
function each_device() {
DEVICES=( $(adb devices | tail -n +2 | cut -sf 1) )
for DEVICE in ${DEVICES[@]}
do
adb -s ${DEVICE} $@
done
}
function monitor_adb () {
adb start-server
echo "[$(date)] adb started"
while [ "$(each_device shell echo 1)" ]; do sleep 5; done
echo "[$(date)] adb is broken,restarting"
adb kill-server
adb start-server || adb start-server
each_device reverse
}
while [ true ]; do time monitor_adb ; done
只需将上述代码保存为.sh文件并使用终端运行即可.现在你不会面临断线问题.