5

A few days ago I started having troubles while trying to install a .apk on my Galaxy S2. I select my phone as the target, click OK and in the Console get the following error:

Failed to install AvatarRun.apk on device 'device number': timeout Launch canceled!

Without changing anything in code and running again I can also get the error:

Failed to install AvatarRun.apk on device 'device number': device not found com.android.ddmlib.InstallException: device not found Launch canceled!

I have tried opening a command window and navigating to android-sdk\platform-tools and running:

adb kill-server adb start-server

This did not fix the issue.

This seems to just be a coincidence, but after failing many times I changed the minimum SDK in the Manifest from 10 to 7 and the .apk loaded on the next try, but has worked intermitently since and generates the same errors.

Can anyone suggest a method for finding what is causing this error?

DigCamara
  • 5,540
  • 4
  • 36
  • 47
neonDion
  • 2,278
  • 2
  • 20
  • 39
  • 3
    Try a different cable. – 323go Mar 22 '13 at 00:22
  • Here is a big thread about this topic. For me this one helped: http://stackoverflow.com/a/4786299/814353 – peitek Mar 22 '13 at 00:56
  • @NormanP: Thanks for the link. I should have mentioned it in my post, but I had read that before and tried extending the ADB timeout, changing cables, restarting PC and android, and reinstalling the Samsung drivers on my PC. The problem is also interittent, so for seemingly no reason it seems to 'fix' itself and allow me to run sometimes. – neonDion Mar 22 '13 at 11:53
  • 1
    possible duplicate of [Android error: Failed to install \*.apk on device \*: timeout](http://stackoverflow.com/questions/4775603/android-error-failed-to-install-apk-on-device-timeout) – Ovidiu Latcu Mar 26 '13 at 10:12

5 Answers5

17

After trying the fixes mentioned above, I ended up installing and reinstalling the Galaxy drivers. This didn't help. What eventually worked (so far) was to switch which USB port the Galaxy is plugged into. Once I did this everything was functioning as it should.

neonDion
  • 2,278
  • 2
  • 20
  • 39
  • lol @user1842396 i never expected this would work , but it did :) Thanks a lot :) – ishhhh Jul 09 '13 at 05:36
  • I have six USB ports: (1) and (2) works perfectly, (3) and (4) allows to view phone's SD, but not to upload/debug apps (which the question stands for), (5) and (6) allows charging only. Possibly USB 2.0/3.0 support affects it somehow? – Nikita Bosik Jan 28 '15 at 09:33
  • Not the most complicated one... but absolutely it solved my problem!! Haha – Sonhja Feb 02 '15 at 14:47
7

It may sound ridiculous, I tried all the ways suggested in Android error: Failed to install *.apk on device *: timeout

None of them works for me except unplugging the current cable and change for a new one.

Community
  • 1
  • 1
ZijunLost
  • 1,584
  • 2
  • 20
  • 25
  • it's not ridiculous this happened with me also. Some time if we used other devices cable this problem may occur, not very often. – u_pendra Mar 21 '14 at 11:28
5

There are various solutions:

  1. Try changing the ADB connection timeout. The default is 5000; you should change it to 10000ms or so.

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

  2. Try to unplug and re-plug the cable. It seems that sometimes Eclipse loses the connection with Device. Sometimes you just need to plug into other USB port.

  3. You might need to kill the ADB process and restart it.

    adb kill-server and then adb start-server

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Vallabh Patade
  • 4,960
  • 6
  • 31
  • 40
3

For me, the solution is to uninstall the old apk from the phone.

hengxin
  • 1,867
  • 2
  • 21
  • 42
0

This problem often shows up if the computer is not fast enough. So,if you go to task manager you will see the performance. If you are watching video or running other programs at the same time while you are running your android application close other programs; at least during installing the app on device or emulator. You might even need to close internet browser.

You might need to update your computer to make it faster if you can.

Hope this helps someone:)

  • Did you actually have this problem, and resolve it by doing this? – Scott Solmer Nov 09 '13 at 22:02
  • It worked for me. I used to get this error one after the other. Sometimes I had to wait more than half an hour to run the application once. I had 2gb memory and emulator itself was using almost all. – user2953067 Nov 25 '13 at 23:57