77

When I tried to reset my adb the following error occurs:

[2011-09-14 09:34:06 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host
[2011-09-14 09:34:07 - DeviceMonitor]Connection attempts: 1

I am just making a simple "hello world" program.

3

12 Answers 12

67

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) and later, 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"

Update (19th March, 2022):

As mentioned in the issue tracker, this issue has been fixed in adb version 33.0.1

2
  • 1
    FYI, issue is here issuetracker.google.com/issues/217251994
    – Pascal
    Mar 17, 2022 at 15:58
  • 33.0.1 still crashes with use of some mDNS servers & clients on my local network. (Guess would be buggy mDNS packet parser being used by adb.) 33.0.3 seems to fix it though. Aug 30, 2022 at 1:57
54

Well, its not compulsory to restart the emulator you can also reset adb from eclipse itself.

1.) Go to DDMS and there is a reset adb option, please see the image below. enter image description here

2.) You can restart adb manually from command prompt

  run->cmd->your_android_sdk_path->platform-tools>

Then write the below commands.

adb kill-server - To kill the server forcefully

adb start-server - To start the server

UPDATED:

F:\android-sdk-windows latest\platform-tools>adb kill-server

F:\android-sdk-windows latest\platform-tools>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
8
  • 1
    [2011-09-14 10:11:59 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host [2011-09-14 10:12:00 - DeviceMonitor]Connection attempts: 1 this error arrises when i tried as u told @suri sahani Sep 14, 2011 at 5:13
  • Yes, you will get that message when you force the connection to close, then you have to start it again, its not an error just a notification for you. Sep 14, 2011 at 5:19
  • 2
    ok let me try that too by the way i had deleted the previous avd and make a new avd and no error found so far Sep 14, 2011 at 5:28
  • but still i do not able to run the program Sep 14, 2011 at 5:45
  • Ok, It will work for you but, sometimes if you fail to work using that you can also try the second way. Sep 14, 2011 at 5:47
16

Change to another USB port works for me. I tried reset ADB, but problem still there.

0
11

Looks like the installed driver was in bad state. Here is what I did to make it work:

  1. Delete the device from Device Manager.
  2. Rescan for hardware changes.
  3. "Slate 21" will show up with "Unknown driver" status.
  4. Click on "Update Driver" and select /extras/google/usb_driver
  5. Device Manager will find the driver and warn you about installing it. Select "Yes."

This time the device got installed properly.

Note that I didn't have to modify winusb.inf file or update any other driver.

Hope this helps.

3
  • 2
    I have to say that this answer was the one and only one that helped me solve my issue. This is very common if the Device disconnects just before the driver is being installed, which will prevent Windows from installing the driver everafter. The only way is to "Force" the installation as Peter suggests or directly by selecting the Driver.
    – will824
    Jul 22, 2014 at 1:31
  • in my case merely directing the device manager to the right driver folder wasn't enough. During the "Update driver software" process, I had to click the "Let me pick from a list of device drivers on my computer" option and select "Android ADB Interface", and that installed the driver successfully
    – woojoo666
    Jan 11, 2015 at 0:08
  • Best and the only answer to solve the problem May 28, 2021 at 11:08
8

In my case, resetting ADB didn't make a difference. I also needed to delete my existing virtual devices, which were pretty old, and create new ones.

0
8

I know I'm 4 years late but my answer is for anyone who may not have figured it out. I'm using a Samsung Galaxy S6, what worked for me was:

  1. Disable USB debugging

  2. Disable Developer mode

  3. Unplug the device from the USB cable

  4. Re-enable Developer mode

  5. Re-enable USB debugging

  6. Reconnect the USB cable to your device

It is important you do it in this order as it didn't work until it was done in this order.

2
  • Thank you very much, I have been struggling with this for ages, with no commonality between occurrences. Resetting ADB simply doesn't work, changing USB sometimes works, but is not a solution... Tried this and it worked first time!
    – gcoulby
    Apr 16, 2016 at 20:36
  • Mixing both of the answer {above abd @Jason H's answer turned out to be working just fine for me :D}
    – Ayyoub
    Dec 8, 2016 at 11:29
5

I faced that after upgrading to Android Studio Bumblebee; and the cause that the adb server doesn't get started automatically, and required to start it manually.

Even I couldn't start it from Android Studio terminal as it blinks and loses the focus while typing.

So, did that instead from the operating system CLI/terminal by using adb start-server. Make sure to call that from AndroidSDK\sdk\platform-tools directory.

If the adb already started, you can try to kill it, then restart it:

adb kill-server
adb start-server

Prepend that with sudo for Unix based Operating systems.

1
  • 1
    This was the answer that worked for me - moving from Visual Studio 2022 to Jetbrains Rider on Mac
    – bownie
    Dec 8, 2023 at 13:24
4

In my case, which none of the answers above stated. If your device is using the miniUsb connector, make sure you are using a cable that is not charge-only. I became accustom to using developing with a newer Usb-C device and could not fathom a charge-only cable got mixed with my pack especially since there is no visible way to tell the difference.

Before you uninstall and go through a nightmare of driver reinstall and android menu options. Try a different cable first.

2
  • 1
    Of course it was the cable.. Every time I have issue with adb I forgot about it and spent long minutes trying all sort of fix. Finally I just try another cable and it works. You should be higher on the page !
    – max54
    Apr 22, 2019 at 2:00
  • @max54 I feel your pain man... I have resorted to giving those cables to my friends now :) Apr 23, 2019 at 3:25
3

Window->Show View->device (if not found ->Other->Device) in right most side, there is arrow, click that, you will see reset adb, just click and enjoy!! It worked for me.

3

For me, it wasn't my antivirus or firewall. I had somehow created a bunch of unnecessary virtual network adapters that were interfering with ADB. If this is the case with you, go to Device Manager -> Network Adapter, right-click the virtual network adapters, and uninstall them. You can always easily recreate them.

This answer is what helped me:

How to remove extra host only network interfaces created by vagrant on windows 10?

2
  • This works for me, great tip
    – Benny
    Mar 4, 2022 at 3:32
  • And you can just disable those virtual network adapter, no need to uninstall
    – Benny
    Mar 4, 2022 at 3:33
2

Latest version of android studio broke this for me.. adb connected just fine after reinstalling 2020.3.1.26, then I tried to upgrade it again just to see.. and yeah.. busted again. Going to version 2020.3.1.26 works for me now.

0

Solution that worked for me on: Ubuntu 20.04, adb 33.0.1, Android Studio Bumblebee 2021.1.1:

  1. Android Studio > Settings > Build, Execution, Deployment > Debugger: Set "Use existing manually managed server" with port 5038.

enter image description here

  1. Close Android Studio
  2. path-to-android-sdk/platform-tools/adb kill-server
  3. path-to-android-sdk/platform-tools/adb start-server
  4. Start Android Studio

Event Log shows that it cannot reach ADB server which is fine. When you run with command in point 3. and 4. adb starts on port 5037. If Studio connected to manually started adb, it'd kill it. That's why 5038 (instead 5037) has to be set in Studio settings.

enter image description here

After next reboot you should just execute 4. and 5.

Not the answer you're looking for? Browse other questions tagged or ask your own question.