我正在开发一个安卓应用程序,我正在使用Macbook Pro,Android Studio 2.1.2 Build #AI-143.2915827,JRE 1.8.0_91和三星S6设备与安卓6来测试我的应用程序。问题是android studio在一段时间后断开了我的设备,它甚至没有在列表中显示我。我几乎已经尝试了我在互联网上找到的所有可能的解决方案。
1) Kill adb server and start it again,
2) Unplug and plug back in device,
3) Unplug device, turn off developer mode, turn on developer mode in device, clear usb debugging authorizations, plug back in device,
4) Change SDK default location in macbook,
5) Restart test device and plug in,
6) Download updated SDK and replace old platform-tools folder
7) Tried changing cables
8) Cleaned and reformatted Macbook with new OS(我找到了第六个解决方案here)
以及我在网上找到的几乎每一个建议/答案。但它仍然不起作用。那么有谁知道我该如何解决这个问题呢?我无法在此设备上测试我的应用程序。我没有任何其他设备,也没有任何其他选项来测试我的应用程序。有没有人能告诉我android studio经常断开测试设备的问题有没有解决方法?
谢谢。
发布于 2016-09-30 01:32:00
我也一直面临着同样的问题。在一些挖掘中,我发现这个问题已经被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文件,并使用终端运行它。现在,您将不会面临断开连接的问题。
发布于 2019-03-19 23:07:55
对我来说,修复它的方法是更换usb端口。
发布于 2016-11-29 11:52:50
将您的Android SDK平台-tools更新到24.0.4或更高版本
查看问题报告here
https://stackoverflow.com/questions/38641164
复制相似问题