I can run and debug my Android app on my phone just fine, most of the time. Then, seemingly randomly, when I try to run or debug my app from Eclipse, the Console in Eclipse says:
[2010-10-12 09:36:48 - myapp] Android Launch!
[2010-10-12 09:36:48 - myapp] adb is running normally.
[2010-10-12 09:36:48 - myapp] Performing com.mycompany.myapp.MyActivity activity launch
[2010-10-12 09:36:48 - myapp] Automatic Target Mode: using device 'HT01TP800561'
[2010-10-12 09:36:48 - myapp] Uploading myapp.apk onto device 'HT01TP800561'
[2010-10-12 09:36:48 - myapp] Failed to upload myapp.apk on device 'HT01TP800561'
[2010-10-12 09:36:48 - myapp] java.io.IOException: Unable to open sync connection!
[2010-10-12 09:36:48 - myapp] Launch canceled!
- Retry: doesn't help, same messages.
- Restart Eclipse: doesn't help.
- Restart adb (
adb kill-server && adb start-server
): no errors, doesn't help. - Reconnect the phone: sometimes helps.
- Reboot the computer: kind of drastic, haven't tried this yet.
Using Ubuntu 10.4, Eclipse Galileo 3.5.2, Android SDK 7, ADT plugin 0.9.6, Nexus One, Android 2.2.1.
Any bright ideas?
What helps for me is the following: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If you are debugging on AndroidX86 (or otherwise have root access to your Android developer machine) Kill the "adbd" process.. and let it restart.
e.g.
[On Android VM]
`ps a| grep adbd | awk ' { print $2 } '
`)[On DEV station]
If you don't have root, probably toggling USB debugging, rebooting, etc could also help. As it also restarts adbd ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The solution is likely to run on your android phone (on local terminal or ssh terminal): $ stop adbd; start adb
I don't like overkill solutions like rebooting hte phone... and this is usually not needed under Linux. I experienced the same problem when connecting over Wifi, so USB is maybe not responsible at all. Reading the answer from user655489, I got the idea to run lsof, and then lsof | grep adbd | wc -l => I think I had over many sockets open with all FD from 0 to 1023 in use... how suspicious.
I ran killall adbd, then restarted adbd per How can I connect to Android with ADB over TCP? And the problem was gone.
The cause is that, at least when debugging and having to kill my non-working apps, that several of the sockets never get closed.
I have had the same problem and restarting ADB wouldn't work for me. Sometimes rebooting my phone worked but not always, I was unable to program for about a week because of this glitch and I think I finally found a workaround! :-D
First of all, kill every program running on your phone. Having some kind of taskmanager makes this a quick task, otherwise you'll have to manually kill them all one at a time.
If that doesn't fix it, you will need to go to your phone settings, then go to "Applications", then go to "Running services", and kill every service in there. I'm using a Droid Incredible and I have yet to have this not work for me. :-)
So, the short answer is, kill all apps, and all services.
Also, keep in mind, you will need to close, and re-open eclipse to see if this fix has worked for you. I hope this works for you, I know it did for me! :-D
I have been experiencing this problem very often (I mean like every second time I launched Debug). I was using a rather long USB cable. I switched to the original HTC USB cable which is short and the problem was gone!
I have been having the same problem when I have the phone connected through my keyboard's USB hub. IT went away when I connected straight to the computer's USB port.
I experienced this problem when my USB cable was connected to PC via keyboard USB :O. When I connected it to PC directly my problem solved.
I hope this works.
Enjoy!