Android Studio Adb connection Error:An existing connection was forcibly closed by the remote host

2,548

It seems this issue has no exact solution, because the cause of this issue is not same for everyone. However, if you have faced this issue recently in Android Studio Bumblebee (2021.1.1) after updating from Arctic Fox, then the problem might have happened due to adb mDNS for wireless debugging.

To solve this issue, disable mDNS for wireless debugging from here:

Android Studio > Settings > Build, Execution, Deployment > Debugger > Untick "Enable adb mDNS for wireless debugging"

SOURCE: https://stackoverflow.com/a/70941381/1372973

Share:
2,548
Zoboo
Author by

Zoboo

Updated on November 28, 2022

Comments

  • Zoboo
    Zoboo over 1 year

    So, I am trying to run an emulator in Android Studio using the AVD Manager, however it never loads my app in the emulator and when I check flutter doctor it states that no devices are connected. Also, whenever I have Android Studio open, the following text repeats in the event log until I close Android Studo:

    12:47 AM * daemon not running; starting now at tcp:5037

    12:47 AM * daemon started successfully

    12:47 AM Adb connection Error:An existing connection was forcibly closed by the remote host

    12:47 AM Cannot reach ADB server, attempting to reconnect.

    12:47 AM error: protocol fault (couldn't read status): Connection reset by peer

    12:47 AM 'C:\Users\Danny\AppData\Local\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary

    I would also like to mention that the emulator was working perfectly fine a week ago, so my computer can handle it, I just did something that broke it. I have also tried replacing my platform-tools folder,re-installing Android Studio, re-installing flutter, using adb kill-server and adb start-server. Nothing seems to work.

    edit: also closing adb.exe in the task manager works... but I need to be able to click on it to close it. It pops up in my task manager for half a second then goes away seemingly randomly.

    edit #2: instances of adb.exe keep opening and suspending in the task manager. I believe this is the problem but solutions online are not working.

    • Jaime
      Jaime almost 4 years
      What happens if you setup a new emulator and try that?
    • Zoboo
      Zoboo almost 4 years
      @Jaime I've tried using multiple emulators they all say the same thing. Funny enough, this morning it was working. The adb.exe process finally appeared in my task manager, I closed it and opened android studio and it was working! But then, later on in the day, it just stopped working...
    • Jaime
      Jaime almost 4 years
      Maybe its something to do with your Antivirus/Firewall I have found windows is funny with external executables sometimes
    • Zoboo
      Zoboo almost 4 years
      @Jaime I have disabled my antivirus many times just to see if it was interfering. It never fixed the problem.
    • W.M.
      W.M. almost 4 years
      In my case, it was because of some other Android based device connected to the same LAN. I have switched it off and ADB works fine now with my target device. Maybe, that other device was attempting to obtain the same IP as my target device. Not sure.
    • Zoboo
      Zoboo almost 4 years
      Unfortunately, I do not have any android devices connected to my computer. I am using an android emulator from android studio thats it though.
    • TKRE
      TKRE about 3 years
      disable mobile hot-spot
    • MαπμQμαπkγVπ.0
      MαπμQμαπkγVπ.0 almost 3 years
      Could this GitHub post related to your problem?
  • tronman
    tronman about 2 years
    I'm using Gradle 7.2 and still having this problem.
  • Saheel Godhane
    Saheel Godhane about 2 years
    Thanks! This worked for me. I faced this issue, as you mentioned, after upgrading to Bumblebee.