Android adb "Unable to open sync connection!"

AndroidEclipseAdb

Android Problem Overview


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?

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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

Solution 3 - Android

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.

Solution 4 - Android

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.

Solution 5 - Android

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.

Solution 6 - Android

This error occurs when somehow the Android Debug Bridge , which is the tool to send data from our computer to the connected device, disconnects. 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 already tried to restart your adb script and seem not working, you just need to reconnect your cable.

Solution 7 - Android

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

Solution 8 - Android

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

Solution 9 - Android

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

Solution 10 - Android

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.

Solution 11 - Android

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

Solution 12 - Android

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 https://stackoverflow.com/questions/2604727/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.

Solution 13 - Android

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]

  • kill adbd (e.g. kill ``ps a| grep adbd | awk ' { print $2 } ' )
  • /sbin/adbd will restart automatically

[On DEV station]

  • [dev station] ./adb disconnect
  • [dev station] ./adb connect

If you don't have root, probably toggling USB debugging, rebooting, etc could also help. As it also restarts adbd ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Solution 14 - Android

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!

Solution 15 - Android

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!

Solution 16 - Android

As per Maven Explanation I tried this solution. but I was getting the same problem. So I restarted the device. And it started working perfectly.

Solution 17 - Android

Try this,

Disabling USB debugging on the phone and then re-enabling under

Settings -> Applications -> Development -> USB debugging

its works fine.

Solution 18 - Android

This solution worked for me

  1. Click Revoke USB debugging authorizations.
  2. Click OK.
  3. Reattach USB.
  4. Click OK for Permissions.

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionThomasView Question on Stackoverflow
Solution 1 - AndroidMavenView Answer on Stackoverflow
Solution 2 - Androiduser153275View Answer on Stackoverflow
Solution 3 - Androiduser655489View Answer on Stackoverflow
Solution 4 - AndroidwhiskitoView Answer on Stackoverflow
Solution 5 - AndroidJuhaniView Answer on Stackoverflow
Solution 6 - AndroidEnrique DiazView Answer on Stackoverflow
Solution 7 - AndroidJaredView Answer on Stackoverflow
Solution 8 - AndroidHalRView Answer on Stackoverflow
Solution 9 - AndroidrolimatView Answer on Stackoverflow
Solution 10 - AndroidRobView Answer on Stackoverflow
Solution 11 - AndroidKurruView Answer on Stackoverflow
Solution 12 - AndroidCyril HolweckView Answer on Stackoverflow
Solution 13 - AndroidRoderick GroesbeekView Answer on Stackoverflow
Solution 14 - AndroidDaniel NovakView Answer on Stackoverflow
Solution 15 - AndroidBobsView Answer on Stackoverflow
Solution 16 - AndroidNarendra PalView Answer on Stackoverflow
Solution 17 - AndroidSilambarasanView Answer on Stackoverflow
Solution 18 - AndroidSiddarth KantedView Answer on Stackoverflow