3

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.

Zoboo
  • 43
  • 1
  • 8
  • What happens if you setup a new emulator and try that? – Jaime Jun 16 '20 at 09:38
  • @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... – Zoboo Jun 17 '20 at 06:01
  • Maybe its something to do with your Antivirus/Firewall I have found windows is funny with external executables sometimes – Jaime Jun 17 '20 at 09:03
  • @Jaime I have disabled my antivirus many times just to see if it was interfering. It never fixed the problem. – Zoboo Jun 17 '20 at 19:37
  • 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. – W.M. Jun 20 '20 at 12:35
  • Unfortunately, I do not have any android devices connected to my computer. I am using an android emulator from android studio thats it though. – Zoboo Jun 21 '20 at 00:05
  • disable mobile hot-spot – TKRE Feb 07 '21 at 12:46
  • Could [this GitHub post](https://github.com/gradle/gradle/issues/14094) related to your problem? – MαπμQμαπkγVπ.0 Jul 21 '21 at 00:31

2 Answers2

2

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

QuelWu
  • 21
  • 2
0

This seems to be an issue with networking on Windows 10. You can try downgrading to gradle 6.1.1 or upgrading to gradle 7.0. Another workaround involves disabling the mobile hotspot on Windows 10. See this GitHub issue thread for more details.

Omatt
  • 8,564
  • 2
  • 42
  • 144