adb Connection reset by peer的解决方法

发布于:2024-08-09 ⋅ 阅读:(187) ⋅ 点赞:(0)

本文同步发于:https://www.cnblogs.com/yeshen-org/p/18350232

最近在编译一个老项目,项目中依赖了很多第三方库,用gradle编译要20-30分钟,而且内存开销很大。
公司配的15G内存的电脑,一次编译能用到14G。
编译的时候,ubuntu有概率会卡死(卡死的问题,网上的方法我尝试了一轮,但是没有用,物理重启电脑有效)。
此为背景。昨晚重启之后,我发现adb用不了了。报错如下:

adb devices
adb shell
error: protocol fault (couldn't read status): Connection reset by peer

adb start-server
adb: failed to check server version: protocol fault (couldn't read status): Connection reset by peer

最后的解决办法

https://forums.linuxmint.com/viewtopic.php?t=415486

step 0

mv ~/.android ~/Download

step 1 diable mDNS for wireless debugging

In Android Studio: Open File / Settings
Go to: Settings / Build, Execution, Deployment / Debugger
In Section "Android Debug Bridge (abd)":
Uncheck "Enable adb mDNS for wireless debugging"

step 2

Restart Android Studio.

step 3

restart the computer.

step 4

adb kill-server
adb server -a

排查过程

排查是否端口占用

adb nodaemon start-server
netstat -tuln | grep 5353

把占用5353端口的udp都给去掉.

export ADB_TRACE=all

wget http://dl-ssl.google.com/android/repository/platform-tools_r30.0.4-linux.zip
./adb start-server

netstat -tuln | grep 5037

把占用5037端口的tcp都给去掉.

重启电脑试图恢复

回家冷静一下

按 start-server 的日志看有没有人遇到类似的问题

adb D 08-09 09:08:44 64447 64447 adb_trace.cpp:187] Android Debug Bridge version 1.0.41
adb D 08-09 09:08:44 64447 64447 adb_trace.cpp:187] Version 30.0.4-6686687
adb D 08-09 09:08:44 64447 64447 adb_trace.cpp:187] Installed as /home/apk/platform-tools_r30.0.4-linux/platform-tools/adb
adb D 08-09 09:08:44 64447 64447 adb_trace.cpp:187]
adb D 08-09 09:08:44 64447 64447 adb_client.cpp:346] adb_connect: service: host:start-server
adb D 08-09 09:08:44 64447 64447 adb_client.cpp:155] _adb_connect: host:version
adb D 08-09 09:08:44 64447 64447 adb_io.cpp:107] writex: fd=3 len=16 30303063686f73743a76657273696f6e 000chost:version
adb D 08-09 09:08:44 64447 64447 adb_io.cpp:81] readx: fd=3 wanted=4
adb D 08-09 09:08:44 64447 64447 adb_io.cpp:88] readx: fd=3 error 104: Connection reset by peer

https://forums.linuxmint.com/viewtopic.php?t=415486


网站公告

今日签到

点亮在社区的每一天
去签到