• 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的配置(未验证)
    解决方法三:找安全组同事处理下…

  • 相关阅读:
    美国服务器速度变慢了有没有解决办法?
    重磅发布 , 阿里云全链路数据湖开发治理解决方案
    华为设备配置VRRP负载分担
    git使用(上传自己的项目到github上)
    零基础该如何学习Java,学习java完整学习路线
    基于智能优化算法的交通流模拟器(Matlab代码实现)
    matlab spm批量配准
    Linux:文件搜索
    k8s搭建 rabbitmq集群
    Kafka-Connect集成clickhouse
  • 原文地址:https://blog.csdn.net/yeshennet/article/details/141054259