简体   繁体   English

Android studio 在 Macbook Pro 中不断断开测试设备有什么解决方法吗?

[英]Is there any fix for Android studio keep disconnecting test device in Macbook Pro?

I am developing an Android app and I am using Macbook Pro, Android Studio 2.1.2 Build #AI-143.2915827, JRE 1.8.0_91 and Samsung S6 device with Android 6 to test my apps.我正在开发一个 Android 应用程序,我正在使用 Macbook Pro、Android Studio 2.1.2 Build #AI-143.2915827、JRE 1.8.0_91 和带有 Android 6 的三星 S6 设备来测试我的应用程序。 The problem is that android studio is disconnecting my device after sometime and it is not even showing me in list.问题是 android studio 在一段时间后断开了我的设备,它甚至没有在列表中显示我。 I have tried almost every possible solution I have found on internet.我已经尝试了我在互联网上找到的几乎所有可能的解决方案。

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

(I found sixth solution here ) (我在 这里找到了第六个解决方案)

and almost every single suggestion/answer I found online.以及我在网上找到的几乎每一个建议/答案。 But still it is not working.但它仍然无法正常工作。 So does anyone have any idea how can I fix this problem?那么有谁知道我该如何解决这个问题? I am not able to test my application on this device.我无法在此设备上测试我的应用程序。 I do not have any other device and I don't have any other option to test my app.我没有任何其他设备,也没有任何其他选项来测试我的应用程序。 Can anyone tell me if there is a fix for this issue where android studio disconnects test device frequently?谁能告诉我是否有解决此问题的方法,即 android studio 经常断开测试设备的连接?

Thanks.谢谢。

I had been facing the same issue as well.我也一直面临着同样的问题。 On some digging, found out that the issue has already been reported and a possible fix might come out soon.在一些挖掘中,发现该问题已被报告,可能很快就会出现可能的解决方案。 Use following script as a workaround fix for disconnection issue -使用以下脚本作为断开连接问题的解决方法修复 -

#!/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

Just save the above code as .sh file and run it using terminal.只需将上面的代码保存为.sh文件并使用终端运行它。 Now you will not face disconnection issue.现在您将不会面临断线问题。

对我来说,它正在更改修复它的 USB 端口。

Update your Android SDK Platform-tools to version 24.0.4 or later将您的Android SDK Platform-tools更新到24.0.4或更高版本

Check out the issue report here在此处查看问题报告

I fixed it by changing from a USB 3.0 to a USB 2.0.我通过从 USB 3.0 更改为 USB 2.0 来修复它。 Similar answer here: Android device keeps disconnecting from adb类似的答案在这里: Android 设备不断断开与 adb 的连接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MacBook Pro Mojave,Android Pie,Android 设备被 adb 识别但未被 Android Studio 识别 - MacBook Pro Mojave, Android Pie, Android Device is recognized by adb but is not recogniced by Android Studio Android Studio 在 MacBook Pro 2021 中安装失败 - Android studio install fail in MacBook Pro 2021 配备 M1 Max 芯片的新款 MacBook Pro 上的 Android Studio? - Android Studio on new MacBook Pro with M1 Max Chip? 如何通过 MacBook Pro 将 Oppo 设备连接到 Android Studio? - how to Connect Oppo devices to Android Studio over MacBook Pro? Android BLE - 成功写入特征后设备保持断开连接 - Android BLE - Device keep disconnecting after a succesfull characteristic write 设备选择器未在Eclipse中显示设备(MacBook Pro) - Device Chooser not showing the device in Eclipse (MacBook Pro) Android Studio Emulator 断开连接 - Android Studio Emulator Disconnecting Oculus Quest 2 - Android 设备在 Macbook Pro 上的 Unity 上没有响应 - 确保 USB 调试已启用 - Oculus Quest 2 - Android Device is not responding on Unity on Macbook Pro - Make sure USB debugging has been enabled Android ble设备有时没有断开连接 - Android ble device is not disconnecting sometime 无法在 MacBook M1 Pro 上通过 Android Studio 安装 Android 模拟器 - Cannot install Android Emulator via Android Studio on a MacBook M1 Pro
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM