An established connection was aborted by the software in your host machine

Android

Android Problem Overview


[2011-04-11 13:27:36 - ddmlib]An established connection was aborted by the software in your host machine
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(Unknown Source)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.write(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
at com.android.ddmlib.Client.sendAndConsume(Client.java:573)
at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:349)
at com.android.ddmlib.Client.requestAllocationStatus(Client.java:419)
at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:840)
at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:808)
at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:767)
at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:635)
at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:42)
at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:563)

Android Solutions


Solution 1 - Android

This problem can be simply solved by closing Eclipse and restarting it. Eclipse sometimes fails to establish a connection with the Emulator, so this can happen in some cases.

Solution 2 - Android

Checkout there might be two instances of Eclipse are pointing to same Android SDK...just keep one instance of Eclipse and try again...that's why you are getting Exception as "established connection was aborted by the software in your host machine"...go in details of android adb(Android Debug Bridge) you will get it...

Solution 3 - Android

I was getting these errors too and was stumped. After reading and trying the two answers above, I was still getting the error.

However,I checked the processes tab of Task Manager to find a rogue copy of 'eclipse.exe *32' that the UI didn' t show as running. I guess this should have been obvious as the error does suggest that the reason the emulator/phone cannot connect is because it's already established a connection with the second copy.

Long story short, make sure via Task Manager that no other Eclipse instances are running before resorting to a PC restart!

Solution 4 - Android

If you develop in multiple IDE's or other programs that connect to AVD you should try closing them too.

Netbeans also can cause conflicts with eclipse if you set it up for NBAndroid.

Solution 5 - Android

I had the problem with multiple IDE. Closing Eclipse, killing from task manager or restarting didnt help. Just deleted the AVD and created it again.

Solution 6 - Android

SOLUTION :-

  1. I was getting the same error as I was opening two eclipse window, so I close one eclipse window and run the app again. You will not get the error.

  2. restart(close and start) the eclipse again if you have open only one eclipse window.

Solution 7 - Android

This problem may occur if you have two devices connected to the computer at the same time. Adb does not support reaching both devices via command/console. So, if you debug your app after connecting and disconnecting the second device you will most probably have this problem. One solution might be restarting adb and/or eclipse if necessary. It can be quite annoying sometimes and I am afraid there is no other solution to that.

Solution 8 - Android

This problem may also occur when you are opening Android Studio and Eclipse at once. Try to close one of them and it might solve your issue.

Solution 9 - Android

In My Case, I was running Android Studio and Eclipse at a time. AS and Eclipse were trying to communicate a device/emulator through adb.

Solution: I closed Android Studio. Then I restarted Eclipse.

Hope this helps you :)

Solution 10 - Android

Close the emulator if already opened. Right click on your project ->Run as -> run configurations -> Run. After the emulator launched: Right click on your project ->Run as ->android project.

Solution 11 - Android

I encountered this issue on my Windows 7 64-bit development machine when running Android Studio 2.1.x and Android Studio 2.2.x side-by-side.

I had deployed an application via the 2.2.x instance the previous day and had left that IDE running. The next day I deployed a different application from the 2.1.x IDE and this is when I encountered the issue.

Shutting down both IDEs and then restarting the 2.1.x IDE resolved the issue for me.

Solution 12 - Android

Restarting the eclipse will solve the problem and kill the "adb disconnect" and then "adb kill-server"

Solution 13 - Android

On a Windows box, I wanted to avoid reboot and these did not work:

  • /android/adt-bundle-windows/sdk/platform-tools/adb kill-server
  • /android/adt-bundle-windows/sdk/platform-tools/adb start-server

So what did work to get adb running again without this error was

  1. wait for the TIME WAIT to complete, which took multiple minutes. You can view the state of the ports and watch when to restart the debugger with this command: "PortQryV2/PortQry.exe -local" This tools is downloaded here: http://support.microsoft.com/?id=832919

  2. force closing ports with "netsh int tcp reset"

Solution 14 - Android

The only thing that worked for me (under windows) was to reopen the IDE as administrator. All worked smoothly after that.

Solution 15 - Android

I solved this problem by closing Eclipse and restarting it again. Eclipse sometimes fails to establish a connection with the Emulator/device, so this can happen sometimes.

Solution 16 - Android

Running Eclipse Luna and using WifiADB app on my phone I started getting this error when Running my app from Eclipse. Oddly, in Indigo (I installed Luna last night) it was working fine.

The problem for me was I had the phone connected to the PC to charge it, and even when running a .bat script to kill ADB it appeared that a second instance was started when Run. Plugging the phone into the monitor to charge when debugging over wifi solved it. I need to debug on wifi sometimes to test my app stopping/starting on power state change.

Of course it reasonable to assume (highly likely) I've just not set Luna up the same.

Solution 17 - Android

This problem appear if two software use same port
generally Android studio use the port 5037
try to close the port by cmd according to your operating system
then reboot your Android studio or your Eclipse

Solution 18 - Android

I was having this problem. Things I tried:

  1. Restart Eclipse
  2. Restart Eclipse & Kill adb as mentioned here.
  3. Restart Machine & Open Eclipse

This is what worked for me

  1. Powered off (pulled plug) my android device, Restart Machine, Power on android device.

Hope this helps someone!

Solution 19 - Android

  1. Close Eclipse
  2. Open Task Manager and kill adb.exe
  3. Start Eclipse It should work.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionkamal_tech_viewView Question on Stackoverflow
Solution 1 - Androidkamal_tech_viewView Answer on Stackoverflow
Solution 2 - AndroidBalaji KhadakeView Answer on Stackoverflow
Solution 3 - Androidsteve-gregoryView Answer on Stackoverflow
Solution 4 - AndroidQuinmaView Answer on Stackoverflow
Solution 5 - AndroidAbhiView Answer on Stackoverflow
Solution 6 - AndroidNikhil KumarView Answer on Stackoverflow
Solution 7 - AndroidmisterbaykalView Answer on Stackoverflow
Solution 8 - AndroidJR TanView Answer on Stackoverflow
Solution 9 - AndroidzackygauravView Answer on Stackoverflow
Solution 10 - Androiduser1207965View Answer on Stackoverflow
Solution 11 - AndroidThomas SunderlandView Answer on Stackoverflow
Solution 12 - AndroidAbhinaiView Answer on Stackoverflow
Solution 13 - AndroidJames YView Answer on Stackoverflow
Solution 14 - AndroidMadly IconicView Answer on Stackoverflow
Solution 15 - AndroidNikhil KumarView Answer on Stackoverflow
Solution 16 - AndroidMr ChopsView Answer on Stackoverflow
Solution 17 - AndroidyacineView Answer on Stackoverflow
Solution 18 - AndroidJason PortnoyView Answer on Stackoverflow
Solution 19 - AndroidDecoderView Answer on Stackoverflow