kamal_tech_view
kamal_tech_view

Reputation: 4255

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

[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)

Upvotes: 137

Views: 254664

Answers (19)

yacine
yacine

Reputation: 167

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

Upvotes: 0

kamal_tech_view
kamal_tech_view

Reputation: 4255

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.

Upvotes: 123

Thomas Sunderland
Thomas Sunderland

Reputation: 462

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.

Upvotes: 1

zackygaurav
zackygaurav

Reputation: 4388

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 :)

Upvotes: 2

Decoder
Decoder

Reputation: 1

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

Upvotes: -2

Mr Chops
Mr Chops

Reputation: 191

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.

Upvotes: 0

Nikhil Kumar
Nikhil Kumar

Reputation: 2914

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.

Upvotes: 0

Madly Iconic
Madly Iconic

Reputation: 1

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

Upvotes: 0

JR Tan
JR Tan

Reputation: 1725

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.

Upvotes: 3

Nikhil Kumar
Nikhil Kumar

Reputation: 2914

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.

Upvotes: 6

Jason Portnoy
Jason Portnoy

Reputation: 807

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!

Upvotes: -2

James Y
James Y

Reputation: 113

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"

Upvotes: 0

user1207965
user1207965

Reputation: 139

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.

Upvotes: 1

Abhinai
Abhinai

Reputation: 1102

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

Upvotes: 0

misterbaykal
misterbaykal

Reputation: 542

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.

Upvotes: 3

Abhi
Abhi

Reputation: 4922

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.

Upvotes: 6

Quinma
Quinma

Reputation: 1476

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.

Upvotes: 10

steve-gregory
steve-gregory

Reputation: 7466

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!

Upvotes: 19

Balaji Khadake
Balaji Khadake

Reputation: 3479

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...

Upvotes: 69

Related Questions