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:
* daemon started successfully *
Or even worse:
* 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:
- Connect your device to the USB port
- Download and run ADBFix.
- Specify the location of your Android SDK.
- Ensure that ADBFix finds the conflicting version of adb.exe:
- Press "Fix all". Ensure that the conflict is marked as "fixed":
- 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.
Download
You can download ADBFix here:adbfix.zip | Download |
|
Tweet |
License
ADBFix is free for commercial and non-commercial use.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.