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.

Community
  • 1
  • 1
Arye Rosenstein
  • 4,236
  • 3
  • 15
  • 15
  • 13
    give a try by just restarting your device. It happens sometimes when our device goes idle. – Vikas Patidar Jan 23 '11 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. – Vikas Patidar Jan 23 '11 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... – Arye Rosenstein Jan 26 '11 at 00:18
  • 1
    Moving code to a path with no spaces was required. Thanks! – DataGraham Jan 09 '13 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 01 '13 at 05:12
  • I got through the problem by doing one or all of the following: 1) USB connection. Connect-disconnect with device or change the USB cable. 2) Restart the phone. 3) Restart Eclipse 4) adb -kill server, and then adb start-server. – erkuy Jul 18 '13 at 08:58

8 Answers8

1134

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)

Bill Tür
  • 2,815
  • 23
  • 33
  • 37
Kraig
  • 7,514
  • 1
  • 12
  • 2
  • 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 '11 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. – DigiOz Multimedia Dec 29 '11 at 08: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 '11 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? – Chad Schultz Jan 24 '12 at 17:16
  • @KarenAnne No, on Mac the preferences menu is under the application's menu not under the Window menu as it is on other platforms. This is the standard location for Preferences on OSX. –  Jun 12 '13 at 14:14
  • 1
    I changed it to 10000ms. It threw the same error. Restarting the device worked in my case. – nous Feb 05 '15 at 21:38
  • After Best Experience, I am Just Plug-in Cable to another port. – Pratik Butani May 12 '15 at 06:05
  • For Android Wear, this fixed my issue - I increased it to 50 seconds just in case, as uploading and installing to my Moto 360 takes a while. – Tom May 27 '15 at 22:33
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.

Ovidiu Latcu
  • 68,451
  • 14
  • 71
  • 82
  • 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 '11 at 14:33
  • 2
    This solved the problem for me too, as opposed to the timeout solution. – Alexander Sep 15 '11 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 07 '12 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 * – Shahzad Imam Sep 20 '12 at 10:48
  • I have to do it half a dozen times every day. Closing the emulator is also necessary, but this is not a big deal because I use Intel Android images that are fast to start. On my version of Eclipse (Juno)., "Reset ADB" is on the menu that shows up when the down arrow on the Devices Tab is clicked. – Hong Apr 30 '13 at 12:04
  • 1
    Connecting phone to the back of the computer insead of front like EDIT2 suggested solved the problem for me. +1 :) – Maciek Feb 03 '14 at 21:44
116

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

Gu1234
  • 3,306
  • 2
  • 20
  • 24
  • 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 '11 at 13:33
  • Thanks for the +1. I agree this doesn't make much sense but the second I changed my cable the timeout problem disappeared. – Gu1234 Jun 16 '11 at 11:23
  • 26
    Confirmed. I can reproduce this problem when running through certain USB extension cables. – Richard Taylor Jul 03 '11 at 14:49
  • Removing my USB extension cable solved the problem for me. Thanks. +1 – Dalmas Nov 09 '11 at 17:30
  • 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! – fatfreddyscat Mar 08 '12 at 18:02
  • I got the same problem when I was using a USB extension cable. That cable must not be a general purpose one because after I changed to another extension cable or not using extension at all, it worked! – Marshal Dec 21 '12 at 11:51
  • 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 '13 at 21:08
  • I plugged out and plugged in the USB cable and BOOM, it worked! – asok Buzz May 10 '14 at 09:18
  • 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. – Brian White Sep 29 '14 at 03:38
  • After Best Experience, I am Just Plug-in Cable to another port. No Need Buy New Cable. – Pratik Butani May 12 '15 at 06:05
43

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

Avinash Raj
  • 160,498
  • 22
  • 182
  • 229
Phi Tran
  • 141
  • 2
  • 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](http://stackoverflow.com/a/6829644/329291) or [change the timeout](http://stackoverflow.com/a/4786299/329291), first make sure you're plugged into a USB 2.x port. – Josh Mar 27 '12 at 23:46
  • 1
    but I have no other options! but rebooting the problematic phone helped me. – Display Name Mar 11 '14 at 21:55
38

Reboot the phone.

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

Hawk
  • 251
  • 3
  • 2
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!!!

tal
  • 281
  • 3
  • 7
  • 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](http://stackoverflow.com/a/9548311/329291) for more details. – Josh Mar 27 '12 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 06 '13 at 01: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.

Richard
  • 209
  • 2
  • 6
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.

Adrian Ferreyra
  • 140
  • 1
  • 7
  • Make sure all of your SDK tools and plugins are up to date after upgrading Android Studio. this was my problem. see my answer with screenshot on this similar question. https://stackoverflow.com/questions/58688663/adb-install-failed/61434394#61434394 – Mathieu J. Apr 26 '20 at 00:41