in android, Java

Android ADB Connection Refused(连接被拒绝)

小结

在对Android进行调试时,出现Android ADB Connection Refused(连接被拒绝)的错误,进行了解决。

问题

在对Android进行调试时,出现Android ADB Connection Refused(连接被拒绝)的错误。

解决

参考Stackoverflow: ADB Android Device Unauthorized
android studio installation failed due to ‘connection refused’

如果是5037 端口被占用,找出5037端口占用的应用,关闭掉该应用进程。
打开cmd命令窗口输入:
netstat -ano | findstr “5037”

继续输入taskkill -f -pid 'pid no.'

或者是重启ADB的服务,如下:

C:\Users\xiong\AppData\Local\Android\Sdk\platform-tools>adb devices
List of devices attached
R58N34YXAWB     unauthorized

C:\Users\xiong\AppData\Local\Android\Sdk\platform-tools>adb kill-server

C:\Users\xiong\AppData\Local\Android\Sdk\platform-tools>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

C:\Users\xiong\AppData\Local\Android\Sdk\platform-tools>adb devices
List of devices attached
R58N34YXAWB     device

可能需要在Android手机上进行重新授权。

参考

Stackoverflow: ADB Android Device Unauthorized
android studio installation failed due to ‘connection refused’
Stackoverflow: Android Studio error “Installation failed due to: ‘Connection refused: connect'”

Write a Comment

Comment