Friday, 1 November 2013

A tool fixing the "adb server is out of date" bug

If you are debugging your Android app on a phone or a tablet over USB, you might get the following message shown every time you (or your debugging tool) runs ADB:
adb server is out of date. killing...
* daemon started successfully *
Or even worse:
adb server is out of date. killing...
* daemon started successfully *
** daemon still not runningerror: cannot connect to daemon
The message will make every small operation involving ADB last 3-5 seconds, making deployment annoyingly slow and failing most of the times.
This happens because your phone sync application (e.g. HTC Sync) has its own version of adb.exe that is incompatible with Android SDK. Every time you connect your phone to a USB port, the sync application will try to start its own version of adb.exe interfering with your one.

The solution

A trivial solution would be to find the old adb.exe (e.g. C:\Program Files (x86)\HTC\HTC Sync 3.0\adb.exe) and delete it. However, this would break the sync application functionality.
To make things better we have developed ADBFix - a small tool that you can download from this page. The tool will detect the older instances of adb.exe that are conflicting with Android SDK and replace them with a stub. The stub will always run the adb.exe from Android SDK instead, so no conflicts will arise.
To fix the "adb server is out of date" bug, please follow these steps:
  1. Connect your device to the USB port
  2. Download and run ADBFix.
  3. Specify the location of your Android SDK.
  4. Ensure that ADBFix finds the conflicting version of adb.exe:
  5. Press "Fix all". Ensure that the conflict is marked as "fixed":
  6. Note that you can always roll back the fix by selecting an ADB instance and pressing "Restore original ADB".

The internals

When you start the tool, it will search for all instances of adb.exe running (and potentially causing future "adb server out of date" messages) and compare their versions with the version of adb.exe from Android SDK. If a version mismatch is found, the tool will rename the old adb.exe to adb_conflicting_backup.exe and put a shortcut to the adb.exe from SDK in place of the old adb.exe.
Thus, both Android SDK and your sync application (e.g. HTC Sync) will use the same version of adb.exe causing no more conflicts.
Note that when you click "Fix All" you will see the "adb server is out of date" message, as adbfix will have to stop the old adb.exe. Once it's successfully stopped, the the new version will be used and the annoying message won't bother you again.


You can download ADBFix

No comments:

Post a Comment

Install Fortesreport community Delphi 7 dan RX Berlin

Download  Pertama2 kita harus punya file installernya terlebih dahulu, download