110

After installing the Android O preview on a test device my ADB stopped working and started giving me this error.

adb server version (36) doesn't match this client (39); killing...
adb E 03-27 08:01:55  2925 147690 usb_osx.cpp:333] Could not open interface: e00002c5
adb E 03-27 08:01:55  2925 147690 usb_osx.cpp:294] Could not find device interface
error: could not install *smartsocket* listener: Address already in use
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon

The only answers I have come across on this issue referred to Genymotion being out of sync with ADB but I don’t use Genymotion. Any help would be greatly appreciated. I have already wiped and reinstalled Android Studio as well as all of its tools and settings yet seem to still have this issue.

ahmadalibaloch
  • 5,851
  • 2
  • 50
  • 59
HTMLlama
  • 1,464
  • 2
  • 11
  • 16
  • 2
    Had the same issue this morning. I was at Android SDK Tools 26.0.0 and Android SDK Platform-Tools 25.0.4. I downgraded to 25.0.3 and 25.0.1 respectively. – mkki Mar 28 '17 at 19:45
  • I also think like @mr5 - maybe my related Q/A helps? https://android.stackexchange.com/a/232860/340401 – Cadoiz Jan 14 '21 at 11:11

9 Answers9

91

This works for me...

  • go to GenyMotion settings -> ADB tab
  • instead of Use Genymotion Android tools, choose custom Android SDK Tools and then browse your installed SDK.
Alecs
  • 2,900
  • 1
  • 22
  • 25
  • 1
    adb server version (39) doesn't match this client (40); killing... i have got this error after updating Android studio to 3.1 and i have choosen custom Android SDK Tools and given this path /AppData/Local/Android/sdk in genymotion and it works for me.. Thank you.. – Nagaraj Pujar Jun 13 '18 at 05:04
  • it's work thanks, first i was choosing plateform-tool and i got error message 'it can't find AAPT tool' then i figure out that i need to choose the root folder 'sdk' – baderkhane Aug 11 '18 at 12:55
  • On Ubuntu 18.04 aapt wasn't installed with adb by default so I had to install it separately then specify the `/usr/lib/android-sdk` folder – dw1 Aug 30 '18 at 20:04
  • For this problem in emulator case, this is the right answer. Not only genymotion, but other emulators. Just make sure the adb version is the same under the `platform-tool` and emulator tool folder. – Bangyno Sep 17 '19 at 03:59
69

In my case this error occured when I set up my environment adb path as ~/.android-sdk/platform-tools (which happens when e.g. android-platform-tools is installed via homebrew), which version was 36, but Android Studio project has Android SDK next path ~/Library/Android/sdk which adb version was 39.

I have changed my PATH to platform-tools to ~/Library/Android/sdk/platform-tools and error was solved

tholu
  • 1,150
  • 2
  • 10
  • 24
Deni Erdyneev
  • 1,779
  • 18
  • 26
  • I had the same issue and it was related to the Path for my environment variables as well. My path was a little different, so keep track of where the AndroidSDK is installed. – wlh Apr 03 '17 at 23:40
  • 44
    Why do you say "I have changed my PATH" without providing the details of how to do this? – oliversisson Jul 20 '17 at 12:41
  • 8
    @user1221780 Sorry, on MacOS you can change your PATH variable by editting `~/.bash_profile`. Open the file `vi ~/.bash_profile`, append the right path `export PATH=$PATH:~/Library/Android/sdk/platform-tools`, save file and call `source $HOME/.bash_profile`. https://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/ – Deni Erdyneev Jul 21 '17 at 10:49
  • 1
    If you are using the homebrew version, you could also update it with `brew update; brew upgrade android-platform-tools` to get it to the latest version. Android studio keeps its platform tools up-to-date with the built-in sdk manager. – Cypress Frankenfeld Feb 13 '18 at 02:58
  • I had adb added to path so just cd to the adb install directory and everything works fine – landrykapela Feb 12 '19 at 16:05
  • I had the same problem. – Augusto Gonzalez Mar 11 '20 at 19:09
  • https://www.nuget.org/packages/AndroidSDK.PlatformTools.ADB/1.0.40 (Find the compatible version here) – Zia Jun 04 '21 at 07:17
52

The main point that all the others have missed, is that you will get this error when you have a running adb process in the background. So the first step is to find it and kill it:

ps aux | grep adb
user          46803   0.0  0.0  2442020    816 s023  S+    5:07AM   0:00.00 grep adb
user          46636   0.0  0.0   651740   3084   ??  S     5:07AM   0:00.02 adb -P 5037 fork-server server

When you find it, you can kill it using kill -9 46636.

In my case, the problem was an old version of adb coming from GapDebug. If you got this with GapDebug, get out of it and then do

adb kill-server
adb start-server

because with GapDebug in the background, when you kill the adb server, GapDebug will start its own copy immediately, causing the start-server to be ignored

ishahak
  • 6,585
  • 5
  • 38
  • 56
  • This was the problem for me. Genymotion had launched an adb server with the old version. After I quit the emulator `adb devices` works again. – Thomas Jan 23 '19 at 06:23
  • Same issue for me - I was running Vysor. I had to close Vysor, then kill and start the server before it worked – kilkfoe Jul 30 '19 at 22:12
21

I had the same problem with Android Studio - adb server version (37) doesn't match this client (39). I fixed by the following solution :

  • In Android Studio go to Tools -> Android -> SDK Manager

  • In the SDK Tools tab untick Android SDK Platform-Tools, click Apply to uninstall.

  • I then renamed the folder Platform-Tools to Platform-ToolsOld

  • Then back in the SDK Manager re-tick the Platform-Tools to re-install.

Cadoiz
  • 1,446
  • 21
  • 31
Benno
  • 2,534
  • 1
  • 17
  • 27
  • 5
    This is correct answer if you just updated to the newer version of android sdk build tools(29.0.1). In my case adb server version (41) doesn't match this client (36); killing... With following this answer I unticked build tools -> apply(uninstall) -> renamed in sdk location (/Users/your_name/Library/Android/sdk/platform-tools). You can find path it in your SDK manager. Then ticked again -> install and you can work again. Additionally check your activity monitor or task manager if you use windows and kill all your adb.exe tasks. Then in your terminal use adb kill-server && adb start-server – Kebab Krabby Jul 16 '19 at 09:14
  • This solution works for me. But its mandatory to close adb with "adb kill-server", otherwise it doesn't work. – BHuelse Dec 05 '19 at 12:48
  • 1
    This solution worked for me. The only difference was that in the Sdk folder there was no platform-tools folder after uninstalling the tools, it got removed automatically. – Stanimir Dimitrov Dec 13 '20 at 10:25
17

I had the same error. In my case, using Appium, I had two versions of ADB

$ /usr/local/bin/adb version 36

and

$ /Users/user/Library/Android/sdk/platform-tools/adb version 39

The solution was:

  1. be sure that your $PATH in bash_profile is pointing to: /Users/user/Library/Android/sdk/platform-tools/

  2. stop the adb server: adb kill-server and check Appium is stopped.

  3. delete the adb version 36 (or you can rename it to have a backup): rm /usr/local/bin/adb

  4. start adb server: adb start-server or just starting Appium

Pablo Gómez
  • 621
  • 1
  • 8
  • 18
  • 2
    This is for MacOSx. This covered my case as well. Steps: 1. `adb kill-server` 2. sudo mv /usr/local/bin/adb /usr/local/bin/adb36 3. echo $PATH 4. Check you /platform-tools/ folder is in it (make sure it has a slash at the end of the path) 5. `adb start-server` – Pablo Ezequiel Leone Aug 26 '19 at 11:40
  • An Amazing Answer. This resolved my issue. It helped me a lot. Thanks @PabloEzequielLeone for your comment as well :) – MukulCode Feb 01 '22 at 13:46
17

As mentioned by others here, that you could have two adb's running ... And to add to these answers from a Linux box perspective ( for the next newbie who is working from Linux );

  1. Uninstall your distro's android-tools ( use zypper or yum etc )

    # zypper -v rm android-tools
    
  2. Find where your other adb is

    # find /home -iname "*adb"|grep -i android
    

    Say it was at ;

    /home/developer/Android/Sdk/platform-tools/adb

  3. Then Make a softlink to it in the /usr/bin folder

     ln -s /home/developer/Android/Sdk/platform-tools/adb  /usr/bin/adb
    
  4. Then;

     # adb start-server
    
MarcoZen
  • 1,556
  • 22
  • 27
16

You have two versions of ADB

$ /usr/local/bin/adb version
Android Debug Bridge version 1.0.36
Revision 0e9850346394-android

and

$ /Users/user/Library/Android/sdk/platform-tools/adb version
Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android

You could see which one your PATH is pointing to (echo $PATH) but I fixed it with a adb stop-server on one version and a adb start-server on the other.

oliversisson
  • 2,229
  • 1
  • 14
  • 14
6

To add yet another potential solution, Helium by Clockworkmod has it's own version of ADB built in that kept being started. Exiting the Helium Desktop application resolves the issue.

HeWhoWas
  • 601
  • 1
  • 10
  • 22
4

I think you have multiple adb server running, genymotion could be one of them, but also Xamarin - Visual studio for mac OS could be running an adb server, closing Visual studio worked for me

Nicolás Loaiza
  • 1,015
  • 11
  • 11