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

Viewed 2896

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.

2 Answers

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

Related