安卓错误: 安装失败。 Time out

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.

转载于:https://stackoverflow.com/questions/4775603/android-error-failed-to-install-apk-on-device-timeout

csdnceshi64
游.程 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.
大约 7 年之前 回复
csdnceshi59
ℙℕℤℝ 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
7 年多之前 回复
csdnceshi63
elliott.david Moving code to a path with no spaces was required. Thanks!
7 年多之前 回复
weixin_41568134
MAO-EYE 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...
9 年多之前 回复
csdnceshi61
derek5. 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.
9 年多之前 回复
csdnceshi61
derek5. give a try by just restarting your device. It happens sometimes when our device goes idle.
9 年多之前 回复

8个回答

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)

csdnceshi54
hurriedly% vote for best combined Solution: steptoinstall.com/…
大约 3 年之前 回复
csdnceshi70
笑故挽风 upvote for referring eclipse instead of android studio
大约 4 年之前 回复
csdnceshi78
程序go 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.
5 年多之前 回复
csdnceshi72
谁还没个明天 After Best Experience, I am Just Plug-in Cable to another port.
5 年多之前 回复
weixin_41568184
叼花硬汉 I changed it to 10000ms. It threw the same error. Restarting the device worked in my case.
5 年多之前 回复
csdnceshi50
三生石@ 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.
7 年多之前 回复
csdnceshi61
derek5. 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?
8 年多之前 回复
csdnceshi62
csdnceshi62 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!
8 年多之前 回复
csdnceshi58
Didn"t forge 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.
8 年多之前 回复
csdnceshi76
斗士狗 Ran in to this problem usually with my Galaxy Tab. Increasing the timeout to 10s seems to have fixed it for now. Thanks!
9 年多之前 回复

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.

csdnceshi52
妄徒之命 Connecting phone to the back of the computer insead of front like EDIT2 suggested solved the problem for me. +1 :)
6 年多之前 回复
weixin_41568126
乱世@小熊 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.
7 年多之前 回复
csdnceshi78
程序go Latcu I got this error * daemon not running. starting it now on port 5037 ADB server didn't ACK failed to start daemon *
接近 8 年之前 回复
weixin_41568126
乱世@小熊 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.
8 年多之前 回复
csdnceshi73
喵-见缝插针 This solved the problem for me too, as opposed to the timeout solution.
大约 9 年之前 回复
weixin_41568131
10.24 Changing the DDMS timeout didn't work for me but this seems to have solved the problem for me. Awesome, thanks!
大约 9 年之前 回复

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

csdnceshi50
三生石@ After Best Experience, I am Just Plug-in Cable to another port. No Need Buy New Cable.
5 年多之前 回复
csdnceshi71
Memor.の 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.
接近 6 年之前 回复
weixin_41568127
?yb? I plugged out and plugged in the USB cable and BOOM, it worked!
6 年多之前 回复
csdnceshi63
elliott.david 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?
7 年多之前 回复
csdnceshi78
程序go 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!
7 年多之前 回复
csdnceshi52
妄徒之命 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!
8 年多之前 回复
weixin_41568134
MAO-EYE Removing my USB extension cable solved the problem for me. Thanks. +1
接近 9 年之前 回复
csdnceshi75
衫裤跑路 Confirmed. I can reproduce this problem when running through certain USB extension cables.
大约 9 年之前 回复
csdnceshi59
ℙℕℤℝ Thanks for the +1. I agree this doesn't make much sense but the second I changed my cable the timeout problem disappeared.
9 年多之前 回复
csdnceshi79
python小菜 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.
9 年多之前 回复

Reboot the phone.

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

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

weixin_41568174
from.. but I have no other options! but rebooting the problematic phone helped me.
6 年多之前 回复
csdnceshi53
Lotus@ 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.
8 年多之前 回复

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

csdnceshi57
perhaps? 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.
7 年多之前 回复
csdnceshi73
喵-见缝插针 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.
8 年多之前 回复

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.

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.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐