adb Connection reset by peer的解决方法

本文同步发于: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

20240827更新

发现更换电脑了之后,还是会这样。

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

./gradlew assembleDebug

FAILURE: Build failed with an exception.

* What went wrong:
Unable to find a usable idle daemon. I have connected to 100 different daemons but I could not use any of them to run the build. BuildActionParameters were DefaultBuildActionParameters{, currentDir=/home/yisheng/ssd/netease/cloud-gaming-sdk/CloudGame, systemProperties size=54, envVariables size=67, logLevel=LIFECYCLE, useDaemon=true, continuous=false, injectedPluginClasspath=[]}.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

解决方法一:可以看看 /usr/bin/qzhddr 这个路径有没有软件,卸载下。
解决方法二:看下iptable,处理下iptable的配置(未验证)
解决方法三:找安全组同事处理下…

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值