6

I get the message

Launch error: Failed to connect to remote VM. Connection timed out.

each time i debug my application on read device. I added to the AndroidManifest the:

<uses-permission android:name="android.permission.SET_DEBUG_APP"/>

and

android:debuggable="true" 

But still this is not helping. When i reset the Eclipse ( close it and open it again ) this problem sometimes solved. Its really hard to work in this way - How can i solve this problem?

Brian Mains
  • 50,520
  • 35
  • 148
  • 257
Yanshof
  • 9,659
  • 21
  • 95
  • 195
  • http://stackoverflow.com/questions/7658197/adb-stops-detecting-my-phone-after-a-while/7658379#7658379 ..the answer from Lalit Poptani..worked for me. – MKJParekh Dec 15 '11 at 11:39

9 Answers9

11

I sometimes have this problem after I disconnect phone from the computer and reconnect again.

I do CTRL + ALT + DELETE and kill all adb.exe processes and it fixes it for me.

Please try if this also works for you.

Note: I find this faster than restarting adb from command line/eclipse

Andrea
  • 11,801
  • 17
  • 65
  • 72
Caner
  • 57,267
  • 35
  • 174
  • 180
7

Just had this bug, tried several things, finally, changing the port worked. I was at port 8600, changed to 8601 and connects instantly! You can find this setting in Windows->Preferences->Android->DDMS. Change default port, apply, and restart Eclipse.

Tony Tieger
  • 113
  • 2
  • 4
4

Just uninstall the app from your device and run the debug again.

ЯegDwight
  • 24,821
  • 10
  • 45
  • 52
Kareem
  • 130
  • 7
3

I don't know why, but this works for me: First Run(or Debug) your application in an emulator and then Debug the application on the device (without closing the emulator).

I know it is not a good solution though, but it's easy.

gnat
  • 6,213
  • 108
  • 53
  • 73
M. Usman Khan
  • 3,689
  • 1
  • 59
  • 69
3

Another thing to try:

In my case I had 2 instances of eclipse running

To solve:

  • Close eclipse
  • Use task manager to kill any additional eclipse processes that are running
  • Restart eclipse
Noah
  • 15,080
  • 13
  • 104
  • 148
2

When running my APP as an Android Application on a Galaxy SII, all worked fine. When debugging the same app, I got the error:

Launch error: Failed to connect to remote VM. Connection timed out.

On my Windows XP there was installed JRE 1.7. After uninstalling Java 1.7 completely, and installing JDK 1.6u26, I was able to debug my app.

apaderno
  • 28,547
  • 16
  • 75
  • 90
2

In Eclipse... Window --> Preferences --> General --> Network connections, choose 'Native' as Acrive Provider.

I had this problem and I became crazy. Now I've resolved.

Geltrude
  • 1,093
  • 3
  • 17
  • 35
1

I had the AVG 2013 on my system, I uninstalled it and everything is working fine. I guess AVG was not allowing the emulator to open the port for debugger.

UmarKashmiri
  • 872
  • 8
  • 15
0

Yeah, I've been having this problem a lot these last few weeks. StackOverflow does not lack in offered solutions, but most involved restarting or killing something.

I noticed the error message included the phrase, 'Connection timed out.', and so I hoped that there was some setting to extend that time and so the attachment wouldn't time out.

There is! What worked for me was to increase the 'timeout' time.

I'm currently on Eclipse Kepler (Build id: 3.0.3-20140327-1716-Typesafe)

Under the Windows menuu -> Perferences -> Java -> Debug

Near the bottom of the window you will see the following field: Debugger timeout(ms): 3000

I just added another zero, 30000, and my troubles were no more.

You may find that your breakpoints continue to be skipped initially, but wait! With this long timeout time now, just keep running past those breakpoints until the debugger successfully attaches and boom! You're stopping at breakpoints.

Better still, start up your app in 'debug mode', fold your arms, wait 30 secs or more...then have at her!

It was the following link that lead to this revelation:

getting Launch error: Failed to connect to remote VM. Connection timed out. which trying to debug my app on my device in android

Drawn
  • 435
  • 1
  • 7
  • 20