685

I'm getting this error from time to time and don't know what causing this:
When trying to run/debug an Android app on a real device (Galaxy Samsung S in my case) I'm getting the following error in the Console:

Failed to install *.apk on device *:

timeout Launch canceled!

This is all the Console is telling me. LogCat doesn't provide any information. Eclipse Problems view is not showing any issues.

I tried the following steps with no success:
1. Cleaning the project (Project->Clean)
2. Restarting device, Eclipse, laptop, all of the above...
3. Moving the project to a location without spaces, according to Failed to install apk on device 'emulator-5554': timeout

The app has been debugged in the past on that device many times (app is live on Market), but this problem happens every so often, and is VERY FRUSTRATING...

Any help would be greatly appreciated! Thanks.

6
  • 13
    give a try by just restarting your device. It happens sometimes when our device goes idle. Jan 23, 2011 at 19:02
  • 2
    If you code has any error then it will show it in Problems View and if a runtime error occurs then it will show it in LogCat View. Thats why they are not providing any information. Jan 23, 2011 at 19:12
  • 2
    Thank you for answering, but the problem still occured after device restart, as I mentioned in my post. Eventually what did the trick for me is reinstalling the smartphone drivers, restarting everything and hoping for the best... Jan 26, 2011 at 0:18
  • 1
    Moving code to a path with no spaces was required. Thanks!
    – DataGraham
    Jan 9, 2013 at 22:06
  • 3
    Sometimes your device is a bit far from your PC. I mean your cable is long or your device is connected to PC via keyboard's USB. Connect it to PC's USB directly
    – Bobs
    Jun 1, 2013 at 5:12

8 Answers 8

1133

Try changing the ADB connection timeout. I think it defaults that to 5000ms and I changed mine to 10000ms to get rid of that problem.

If you are in Eclipse, you can do this by going through

Window -> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)

8
  • 2
    Ran in to this problem usually with my Galaxy Tab. Increasing the timeout to 10s seems to have fixed it for now. Thanks!
    – Jon Turner
    Mar 30, 2011 at 22:56
  • 2
    Thanks for the hint, although I had to set it to a much higher value in my case since my environment seems to be running a lot slower. Dec 29, 2011 at 8:11
  • 17
    I actually had to raise mine to 60000ms, but it worked in the end. Might be something with the usb speed or i don't know what... Thanks!
    – moraleida
    Dec 30, 2011 at 17:30
  • 7
    This solution worked for me. Out of all my testing devices, this only occurred on the Samsung Galaxy S (Mac OS X, Eclipse Indigo). Maybe it's an issue with Samsung devices? Jan 24, 2012 at 17:16
  • 1
    I changed it to 10000ms. It threw the same error. Restarting the device worked in my case.
    – nous
    Feb 5, 2015 at 21:38
194

What I usually do when I get this error is restarting the adb server by typing in the cmd:

adb kill-server

adb start-server

EDIT: With some never versions of the Platform Tools you can do this from the DDMS Perspective in the Devices Tab menu (near the Capture Button), click on Reset adb.

EDIT2: Also I found out that it is preferable to use the USB port in the back of your PC, since most of the front USB ports are low powered, and really seem to be slower when uploading apks on your devices.

6
  • 10
    Changing the DDMS timeout didn't work for me but this seems to have solved the problem for me. Awesome, thanks!
    – Zac Seth
    Aug 23, 2011 at 14:33
  • 2
    This solved the problem for me too, as opposed to the timeout solution.
    – Alexander
    Sep 15, 2011 at 12:23
  • For my case, this definitely points to the right direction. Timeout change has no effect. Rebooting the device always works, reset somehow puts the device in offline mode. It seems that the graceful exit of the app before uploading a new version is the key for my case.
    – Hong
    Mar 7, 2012 at 15:12
  • @Ovidiu Latcu I got this error * daemon not running. starting it now on port 5037 ADB server didn't ACK failed to start daemon * Sep 20, 2012 at 10:48
  • 1
    Connecting phone to the back of the computer insead of front like EDIT2 suggested solved the problem for me. +1 :)
    – Maciek
    Feb 3, 2014 at 21:44
116

I used to have this problem sometimes, the solution was to change the USB cable to a new one

10
  • 3
    Maybe the bad connection can prevent from the connection to the device to succeed. It can make sense, but you'd better try with a friend's cable before buying a new one :) +1 because he doesn't deserve a bad point for that.
    – Julien
    Jun 14, 2011 at 13:33
  • 26
    Confirmed. I can reproduce this problem when running through certain USB extension cables. Jul 3, 2011 at 14:49
  • 2
    I had like 6 devices, no problem. Then I tried this samsung galaxy s phone and it just wouldn't allow the install (even with changing the timeout, etc.). Tried a different cable and ta-da, it worked. Thanks! Mar 8, 2012 at 18:02
  • 2
    Grrr, why should this matter??? Talk about poor dev tools... I assume this is my problem since I've tried the top 2 answers already. So now it's just a USB cable crapshoot?
    – Brade
    Feb 11, 2013 at 21:08
  • 1
    The USB 2.0 spec (and probably others, but that is the only one I've read) explicitly forbid "extension cables" on the grounds that it made it possible to exceed the maximum cable length and making for unreliable operation. In other words, extension cables were forbidden so USB wouldn't be a crap-shoot. My (short) cable seems to work fine when I changed to a different USB port. Sep 29, 2014 at 3:38
44

don't use USB 3.0 ports for connection beetwen PC and Android phone!

USB 3.0 - Port with blue tongue

USB 2.0 - Port with black tongue

2
  • 3
    Thank you! This shouldn't be so far down here. This is the only thing that has fixed this problem for me. I tried all the other solutions in various different ways. I even tried all the fixes against 2 devices (N1 and Transformer) and 3 cables. I think there are multiple issues going on here depending on the device, It would be nice if we could fork a question or something like that. Either way, before you restart adb or change the timeout, first make sure you're plugged into a USB 2.x port.
    – Josh
    Mar 27, 2012 at 23:46
  • 1
    but I have no other options! but rebooting the problematic phone helped me. Mar 11, 2014 at 21:55
38

Reboot the phone.

Seriously! Completely power down and power up. That fixed it for me.

0
18

I have encountered the same problem and tried to change the ADB connection timeout. That did not work. I switched between my PC's USB ports (front -> back) and it fixed the problem!!!

2
  • Tal, you were on the right track with this. The reason switching ports fixed the issue for you, is that most likely your front ports are USB3 and your others are USB2. See my comment on another answer for more details.
    – Josh
    Mar 27, 2012 at 23:51
  • I was successfully using a front port. Did a Clean and tried to debug and it would not install. Tried increasing timeout, restarting adb, rebooting phone, restaring Eclipse to no avail. Switched to a back port and it started working again.
    – Jim Rhodes
    Mar 6, 2013 at 1:11
16

I get this a lot. I'm on a Galaxy S too. I unplug the cable from the phone, plug it back in and try launching the app again from Eclipse, and it usually does the trick. Eclipse seems to lose the connection to the phone occasionally but this seems to kick it back to life.

11

I know it sounds silly, but after trying everything recomended for this timeout issue on when running on a device, I decided to try changing the cable and it worked. It's a Coby Kyros MID7015.

Trying another cable is a good and simple option to take a chance on.

1

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