137

I'm running my Appium script with Python instead of py.test because py.test does not play nicely with variables I want to get from a text file. When I run my script with Python everything works except that my first method always has an error.

Does anyone know how to fix the following error?

adb server version (31) doesn't match this client (36)
adb server version (32) doesn't match this client (36); killing...
Cadoiz
  • 1,446
  • 21
  • 31
DevBrandonJ
  • 1,369
  • 2
  • 9
  • 6
  • can you paste rest of the error logs – Gaurav Lad Jul 07 '16 at 04:26
  • http://pro.sr1.me/post/android-sdk-download-links, i use this to downgrade platform-tools – Zam Jul 19 '16 at 08:57
  • 2
    This was caused in my case by running Visual Studio with an Android Xamarin project on the same machine as Android Studio - each IDE had a different adb server version running. I closed Visual Studio and the error went away. – dodgy_coder Nov 12 '18 at 08:09

17 Answers17

176

In my case the solution was this on an Ubuntu based OS:

adb kill-server
sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin/adb
sudo chmod +x /usr/bin/adb
adb start-server

kudos: https://stackoverflow.com/a/38166059/3765109

efkan
  • 12,991
  • 6
  • 73
  • 106
172

I fixed this by doing the following:

  1. going into GenyMotion settings -> ADB tab,
  2. instead of Use Genymotion Android tools (default), I chose Use custom Android SDK Tools and then browsed to my installed SDK.
Sufian
  • 6,405
  • 16
  • 66
  • 120
tarrant
  • 2,633
  • 1
  • 17
  • 10
  • 3
    Is there anyway to update android sdk adb? – SalahAdDin Sep 24 '16 at 02:48
  • Sorry, have not checked this at all. I was using Appium and not GenyMotion. – DevBrandonJ Oct 11 '16 at 15:18
  • 2
    Settings is available separately inside the Genymotion application and not inside the android studio. – nizam.sp Oct 16 '16 at 11:43
  • 2
    Android Studio Uses this Path: /Users//Library/Android/sdk ...... Homebrew Uses this Path: /usr/local/Cellar/android-sdk/ where in my case was 24.4.1_1 – Jarvis Oct 18 '16 at 18:20
  • From Genymotion 2.6 onwards, if you want to install google apps package (required from play services) the SDK path option in the settings of genymotion must be "Use Genymotion Android tools (default)". When i do so i got this error in adb start-server: "adb server version (32) doesn't match this client (36); killing...". – Gem Jan 05 '17 at 10:52
61

One possible reason for the occurrence of this error is due to the difference in adb versions in the development machine and the connected connected device/emulator being used for debugging.

So resolution is:

  1. Firstly disconnect device/emulator.
  2. Run on terminal/command prompt following commands:

    adb kill-server
    adb start-server
    

This will start the adb successfully. Now you can connect device. Hope it helps.

Sufian
  • 6,405
  • 16
  • 66
  • 120
Napolean
  • 5,303
  • 2
  • 29
  • 35
  • Yeah I'm already doing that cause I though that might be the problem. I have in my bash script before I run my python script. I believe I know what the problem is, not sure how to fix it. thank you though – DevBrandonJ Jul 06 '16 at 14:15
  • 1
    Changing the Genymotion SDK path and restarting the adb server worked for me. Just in case someone changes the path and nothing happens – Tinashe Chinyanga Nov 10 '16 at 09:06
40

It seems there are 2 adb version in your system. Please find them out and keep the adb in your Android SDK folder only, delete all others folders that including adb file. You can find out which adb you are using from Application Monitor:

enter image description here

It might be a problem if the adb is not the one in you Android SDK folder.

In my case, I found I was running adb from here:

/Library/Application Support/RSupport/Mobizen2

after deleting the Mobizen2 folder, then all adb commands work fine.

DàChún
  • 4,751
  • 1
  • 36
  • 39
  • 1
    I had installed ["TC Games"](http://www.sigma-rt.com/en/tcgames/) and it included its own adb, removed it and all worked well again. – Pierre Feb 11 '20 at 08:18
34

Exactly same problem. Tried kill and start but what this worked for me:

adb reconnect

Hope it helps.

Shah Rukh Qasim
  • 447
  • 4
  • 5
  • 1
    Actually this worked. I am not using Genymotion and I have only one ADB installed (I even uninstalled the previous one and did everything again). – El Mac Oct 07 '16 at 09:26
  • This is a temporary fix; doesn't resolve the underlying issue of having multiple versions of adb on your system – Oke Uwechue Oct 18 '22 at 14:50
28

For anyone still having this issue ( on windows ):

  1. Open task manager
  2. Go to processes and select the ADB.EXE
  3. Right-click on it and check the properties
  4. Most likely you will see a different path from where the adb.exe is running ( either HTC manager, Genymotion, etc )
  5. Kill the process
  6. Run ADB.exe from your android studio path ( in my case: C:\Users\%user%\AppData\Local\Android\sdk\platform-tools )

This solved the problem in my case.

Catalin
  • 291
  • 3
  • 2
13

On Windows, just check in the windows task manager if there are any other adb processes running.

Or run adb kill-server

If yes, just kill it & then perform the adb start-server command.

I hope, it should solve the problem.

bereket gebredingle
  • 12,064
  • 3
  • 36
  • 47
Deepak Verma
  • 101
  • 1
  • 3
  • This worked for me. Not sure where the other ADB server comes/came from but it's not expected so it's not needed. Ty. – JoelAZ Oct 10 '22 at 18:29
12

Most likely you have several adb version on your computer. You start adb server using one version and then trying to connect to this server using another version. For example - Genymotion has it's own adb and if you start Genymotion emulator and then try to use adb from Android SDK most likely you will have such error (the latest Genymotion which is 2.7.2 has adb version 1.0.32 while the latest Android SDK has adb version 1.0.36).

user1991679
  • 2,109
  • 1
  • 23
  • 19
  • What do I do in such a case if I still want to use Genymotion? Donwgrade my adb version? – Juan José Melero Gómez Jul 20 '16 at 18:14
  • I've just verified that this is my case. I'm using platform-tools 1.0.36, but Genymotion 2.6 uses adb 32. When I run a Genymotion emulator and try to run the app, no devices are detected. But if I close the emulator and then run the app, adb detects all my other devices. So what I did was starting Genymotion emulator from Android Studio and then, quickly, run the project before the emulator is entirely started. Then all my devices appear on the list and when the emulator is entirely started, it also appears on the list. – Juan José Melero Gómez Jul 20 '16 at 19:02
  • 1
    Well, I had the same issue and ended up with replacing Genymotion version of adb with up to date version from Android SDK. I'm not sure that this is the best solution but it works. – user1991679 Jul 21 '16 at 12:40
  • How did you do that? – Juan José Melero Gómez Jul 21 '16 at 13:49
  • 2
    Copy adb.exe from Android SDK (it should be in platform-tools folder) to Genymotion (should be in tools folder). So for example if Android SDK is installed in C:\android-sdk and Genymotion in c:\Program Files\Genymobile\Genymotion\ you need to copy the file from c:\android-sdk\platform-tools\adb.exe to c:\Program Files\Genymobile\Genymotion\tools\adb.exe (make backup copy... just in case) – user1991679 Jul 22 '16 at 08:40
  • Uninstalling the extra adb version solved the problem, thanks! – alierdogan7 Aug 08 '16 at 12:11
  • 2
    You can also change the SDK tools path in genymotion settings. Genymotion uses its own SDK tools by default. Just point genymotion to your SDK folder. Turn off the emulator, go to Genymotion Settings, then ADB tab and select Use Custom Android SDK tools and provide a path. – CuriousGeorge May 30 '17 at 19:31
8

For those of you that have HTC Sync installed, uninstalling the application fixed this problem for me.

moosexpress
  • 81
  • 1
  • 1
7

For me it was happening because I had android tools installed in two places: 1. The location where I manually downloaded it from google 2. Automatic download by Android studio

What I was able to do was completely delete the folder in #1 and point my bash profile and all other references to the location where Android studio installed it for me: /Users/my_user_name/Library/Android/sdk

This solved it.

HRVHackers
  • 2,793
  • 4
  • 36
  • 38
  • This is what happened to me also. When I installed Xamarin for something iOS related, it also installed it's own version of android sdk. I deleted the Xamarin android sdk folder at `/Users/myname/Library/Developer/Xamarin` – Adam Johns Oct 30 '16 at 06:26
3

I had same problem since updated platfrom-tool to version 24 and not sure for root cause...(current adb version is 1.0.36)

Also try adb kill-server and adb start-server but problem still happened

but when I downgrade adb version to 1.0.32 everything work will

gsyu
  • 31
  • 2
  • @canyo how to downgrade adb to 1.0.32? – Zam Jul 19 '16 at 08:24
  • @Zamyesterday There are many way I think, but fast way is download from goolge [link](https://dl-ssl.google.com/android/) and seconde compile from AOSP – gsyu Jul 20 '16 at 13:14
2
  1. adb kill-server
  2. close any pc side application you are using for manage the android phone, e.g. 360mobile(360手机助手). you might need to end them in task manager in necessary.
  3. adb start-server and it should be solved
1

What worked for me:

  1. adb kill-server
  2. Close all chrome://inspect/#devices windows/tabs
  3. adb start-server
  4. adb devices
Mikel
  • 5,902
  • 5
  • 34
  • 49
1

Mainly you need to delete duplicate adb.exe file. You can use Everything to Find.

keep the platform-tools adb.exe

and add the platform-tools directory to your Environment Path Variable.

I am using Memu Emulator.

So, I have taken these steps:

Go to Memu Installation Directory: (In My Case D:\Program Files\Microvirt\MEmu)

And then Delete the adb.exe file.

It should work fine for you.

Riajul
  • 1,140
  • 15
  • 20
0

This issue for me was caused by having apowermirror running at the same time, from what I can tell any software that could use a different version of adb could cause these issues as others mention in this thread this can include Genymotion or from other threads unreal studio was the problem.

CHurst
  • 21
  • 3
0

If you are using android studio then give it a try:

Remove and path variable of adb from system variable/user variable. Then go to terminal of android studio and then type there command adb start-service.

I tried this and it worked for me.

Amit
  • 105
  • 1
  • 6
-1

I've recently had this issue too and after none of the answers on here worked I realised that the APK I was testing against would have been built against the latest sdk.

So I went into the Appium settings and changed the platform version to the latest version and this resolved the issue for me.

Christian Barron
  • 2,695
  • 1
  • 14
  • 22