How to solve this adb server version doesn't match this client error in android?

vijay kumar picture vijay kumar · Sep 21, 2018 · Viewed 40.6k times · Source
adb server version (39) doesn't match this client (40); killing...
could not read ok from ADB Server
* failed to start daemon
error: cannot connect to daemon
adb: error: failed to get feature set: protocol fault (couldn't read status): Connection reset by peer
* daemon not running; starting now at tcp:5037
* daemon started successfully
- waiting for device -
error: protocol fault (couldn't read status): Connection reset by peer

Answer

Md. Sultanul Arefin picture Md. Sultanul Arefin · Nov 24, 2018

I have the same issue when running adb devices command.

adb devices
List of devices attached
adb server version (36) doesn't match this client (40); killing...
* daemon started successfully
2322dc3d    device

I ran command which adbwhich gave me the location of the adb that the previous command was using, in my case output was:

which adb
/usr/bin/adb

Then i ran whereis adb command which gave me the location of adb's:

whereis adb
adb: /usr/bin/adb /home/arefin/Android/Sdk/platform-tools/adb 
/usr/share/man/man1/adb.1.gz

I get rid of this problem by moving the adb from /usr/bin directory with mv command: (meaning this is of no use thus instead of deleting just put in desktop),

/usr/bin$ `sudo mv adb /home/arefin/Desktop/`

After this i executed this command adb kill-server then ran adb devices. I found everything is fine this time.

My Android development related path in in $HOME/.profile file is, as below:

export ANDROID_HOME=/home/arefin/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$JAVA_HOME/bin