Thursday, May 31, 2012

Android adb "Unable to open sync connection!'

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] 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 killserver && 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?

Source: Tips4all


  1. I was having exactly the same problem, but I already had my phone connected to the computer's USB port. Sometimes disconnecting and reconnecting the cord worked but then it stopped working completely.
    However, disabling USB debugging on the phone and then re-enabling it has worked so far. Hopefully it keeps working! These fixes really seem like silly hacks.. I'm not sure what the underlying problem is.

  2. I was able to clear this only by cycling the USB Debugging option on the phone.

  3. 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.

  4. This may also be related to a "too many open files" issue. I manually tried to install the app when getting the "sync" error above and that's when I got the "too many open files" clue. one brute workaround, based on some old posts, seems to be to restart the phone, and one google engineer suggested doing it twice, the second time before it goes into sleep mode the first time (details on why in the post).

    That was a few years ago, and maybe they've fixed it, or just did some things to get around it in the usual cases and the reinstall-as-part-of-development is not a case that it addresses.

  5. I see this problem regularly in both attached devices (Phone or Tablet) and even the emulators. I noticed that the problem often follows periods of inactivity (after a lunch break for example). It may be that the Operating System on the development machine is trying to conserve resources and adb just isn't all that JIT friendly.
    On windows I have to close the IDE and open Task Manager and force stop (kill) adb, then relaunch Eclipse. This always works for me...

    I noticed if I set a higher priority in task manager for adb, this problem is greatly reduced--although it can still happen.

  6. 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

  7. When this happens on the Kindle Fire I just power it off and back on again.

  8. I fixed it just by disabling and enabling the debugging configuration on my device (SonyEricsson Xperia)

  9. Nexus One here, CyanogenMod 7 (Android 2.3.7)... disable and reenable:

    Settings > Applications > Development > USB debugging

    And everything works now on Eclipse and Mac OS X 10.7.3.

  10. This error occurs when somehow the Android Debug Bridge is the tool to send data from our computer to the connected device. As we know, there are some layers to get connected like the adb itself and of course, the last layer is the USB cable, so when you've tried to restart your adb and seem not working, you need to reconnect your cable.

  11. Restarting the phone has also fixed this problem for me whenever reseting the usb cable didnt fix it

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

  13. 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.

  14. 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.