Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adb server version (41) doesn't match this client (40) #527

Closed
fabriziocacicia opened this issue May 9, 2019 · 61 comments
Closed

adb server version (41) doesn't match this client (40) #527

fabriziocacicia opened this issue May 9, 2019 · 61 comments
Labels

Comments

@fabriziocacicia
Copy link

fabriziocacicia commented May 9, 2019

I'm facing this error starting from today:

adb server version (41) doesn't match this client (40); killing...
ADB server didn't ACK
Full server startup log: /var/folders/0q/jh77wwcx1cs989k89kv79mqr0000gn/T//adb.501.log
Server had pid: 34316
--- adb starting (pid 34316) ---
adb I 05-09 21:30:11 34316 4407796 main.cpp:56] Android Debug Bridge version 1.0.40
adb I 05-09 21:30:11 34316 4407796 main.cpp:56] Version 28.0.2-5303910
adb I 05-09 21:30:11 34316 4407796 main.cpp:56] Installed as /usr/local/bin/adb
adb I 05-09 21:30:11 34316 4407796 main.cpp:56] 
adb I 05-09 21:30:11 34316 4407799 usb_osx.cpp:308] reported max packet size for ce061716d90b602a027e is 512
adb I 05-09 21:30:11 34316 4407796 auth.cpp:405] adb_auth_init...
adb I 05-09 21:30:11 34316 4407802 transport.cpp:283] ce061716d90b602a027e: read thread spawning
adb I 05-09 21:30:11 34316 4407803 transport.cpp:296] ce061716d90b602a027e: write thread spawning
adb I 05-09 21:30:11 34316 4407796 transport.cpp:1334] fetching keys for transport ce061716d90b602a027e
adb I 05-09 21:30:11 34316 4407796 auth.cpp:457] Calling send_auth_response
adb I 05-09 21:30:11 34316 4407796 adb.cpp:114] ce061716d90b602a027e: offline
adb server killed by remote request
adb I 05-09 21:30:14 34316 4407796 transport.cpp:339] BlockingConnectionAdapter(ce061716d90b602a027e): stopping
adb I 05-09 21:30:14 34316 4407796 usb_osx.cpp:561] Kicking handle
adb E 05-09 21:30:14 34316 4407802 usb_osx.cpp:541] usb_read failed with status: e00002eb
adb I 05-09 21:30:14 34316 4407802 transport.cpp:287] ce061716d90b602a027e: read failed: Undefined error: 0
adb I 05-09 21:30:14 34316 4407802 transport.cpp:676] ce061716d90b602a027e: connection terminated: read failed
adb I 05-09 21:30:14 34316 4407796 transport.cpp:357] BlockingConnectionAdapter(ce061716d90b602a027e): stopped

* failed to start daemon
adb: error: failed to get feature set: cannot connect to daemon
2019-05-09 21:30:14.285 scrcpy[34314:4407786] ERROR: "adb push" returned with value 1

I attached the content of /var/folders/0q/jh77wwcx1cs989k89kv79mqr0000gn/T//adb.501.log
adb.501.log

@rom1v
Copy link
Collaborator

rom1v commented May 10, 2019

adb server version (41) doesn't match this client (40); killing...

A priori, you just upgraded your platform-tools. Once the server is killed and it started the adb server 41, it should work.

Does it happen again if you start scrcpy once again?

@rom1v rom1v added the adb label May 10, 2019
@fabriziocacicia
Copy link
Author

adb server version (41) doesn't match this client (40); killing...

A priori, you just upgraded your platform-tools. Once the server is killed and it started the adb server 41, it should work.

Does it happen again if you start scrcpy once again?

Yes, sure. I tried many many times before posting here.
But I just tried to execute the command "scrcpy" again and again. There is some other command to let scrcpy use the new version of the server?

@rom1v
Copy link
Collaborator

rom1v commented May 10, 2019

So you have several adb versions running. Something on your system starts (and seems to restart when it dies) the server with adb 41.

And scrcpy uses your adb 40.

What is the result of adb version?
Find where your adb 41 binary is, and you can force it:

ADB=/path/to/some/adb scrcpy

A better way would be to change your PATH so that it always finds the right adb.

@fabriziocacicia
Copy link
Author

Ok, thank you for your help. I had two different versions of adb: one at /usr/local/bin and one in a custom path.
The shell was using the /usr/local/bin, Android Studio instead was using the one in the custom path.

Now everything si fine.

@bao1410227
Copy link

Capture
Capture2

Hi all, replace 3 files in "scrcpy" folder by their version in "platform-tools" maybe work.

I hope this will be useful !!!

@francyfre
Copy link

Ok, thank you for your help. I had two different versions of adb: one at /usr/local/bin and one in a custom path.
The shell was using the /usr/local/bin, Android Studio instead was using the one in the custom path.

Now everything si fine.

excuseMe... i have exact this problem... i have Android Debug Bridge version 1.0.41 but when i start it telle me: adb server version (40) doesn't match this client (41); killing... exact like your....
you write some version in: /usr/local/bin that is different from: /usr/local/bin (that i have)! i dont find usr/local/bin........ and i cannot understand where is versione 40 of the server.... can somobody can help me; because i dont understand the solutions of that problem!!
thanYouVeryMuch
francesco

@francyfre
Copy link

@rom1v can you explain me better how to use this command: ADB=/path/to/some/adb scrcpy

@rom1v
Copy link
Collaborator

rom1v commented Jul 28, 2019

The idea is to set the environment variable ADB (which is read by scrcpy).

In a shell (typically on linux), you can set the variable for a single command:

VAR=value command

On Windows, you can set it globally in Windows preferenced, but you can also set it locally:

set VAR=value
command

So:

set ADB=C:\path\to\adb.exe
scrcpy

@francyfre
Copy link

francyfre commented Jul 29, 2019

thank... @rom1v
i exec: set ADB=C:\...\AppData\Local\Android\Sdk
because i understand this! all my software is update to last version, all path of environment variable is set on windows.... adb on cmd GO! but... when i want to play project on Android Studio tell me:

Unable to connect to ADB. Check the Event Log for possible issues. Verify that your localhost entry is pointing to 127.0.0.1 or ::1 for IPv4 or IPv6, rispectively.

now i try to do that i understand of your suggest; but i cannot understand why dont go! i check and i havent any other version of ADB! is only in one place!

thanYou
Francesco

@rom1v
Copy link
Collaborator

rom1v commented Jul 29, 2019

i exec: set ADB=C:...\AppData\Local\Android\Sdk

You must use the full path to the binary:

set ADB=C:\...\AppData\Local\Android\Sdk\platform-tools\adb.exe

@francyfre
Copy link

ok true, i set this but have same problem :(

@francyfre
Copy link

@rom1v
i make that you suggest! but there is always same problem :( :(
i dont know what i can do.... is second time that i delete and re-intall all android platform... and always always same problem for ADB
in cmd adb funtions!!!!!!!

@rom1v
Copy link
Collaborator

rom1v commented Jul 30, 2019

What are the results of:

adb version

and

C:\...\AppData\Local\Android\Sdk\platform-tools\adb.exe version

?

also:

echo %PATH%

@francyfre
Copy link

adb version:
Android Debug Bridge version 1.0.41
Version 29.0.1-5644136
Installed as C:\Users...\AppData\Local\Android\Sdk\platform-tools\adb.exe

C:\Users...\AppData\Local\Android\Sdk\platform-tools\adb.exe version
Android Debug Bridge version 1.0.41
Version 29.0.1-5644136
Installed as C:\Users...\AppData\Local\Android\Sdk\platform-tools\adb.exe
IS THE SAME!!!

echo %PATH%:
here i see that platform-tools is inside 4 time... with same address!
i dont know why platform-tools there is more times... some are system variables anb others are user variables; i think
now i will go to check!

thankYouuu for now
Francesco

@rom1v
Copy link
Collaborator

rom1v commented Jul 30, 2019

Oh, but your problem is the reverse:

adb server version (40) doesn't match this client (41);

You correctly uses v41, but some app on your computer executes adb commands with adb v40. You must find this app and stop it 😉

@francyfre
Copy link

francyfre commented Jul 30, 2019

yes, when i use adb devices on cmd i have this error... who use other adv v40??????? i think visual studio code... but no! it dont find phone for the same problem like Android studio!

ehmmmmm yes probably yess... i cannot understand why; when i start to play emulator on Android Studio; and if there is my phone on usbCable... all process go in error!!!!

@francyfre
Copy link

who uses ADB version 40? i cannot understand :( :( :(

@rom1v
Copy link
Collaborator

rom1v commented Jul 30, 2019

Check in your process list (in your taskmanager or something).

@francyfre
Copy link

@rom1v
https://stackoverflow.com/questions/43837621/how-to-terminate-adb-exe-on-windows-what-keeps-restarting-it

i have exact this problem... i dont know who restart adb.exe every time i stop and delete process on Task Manager (windows)....

@francyfre
Copy link

francyfre commented Jul 30, 2019

i follow the process!!! i understand!!!!!!!!!!!!!!!! probably is app that i use for view windows on android tablet to start every time ADB!!!!
thankYouForHelp.... without your help i cannot understand! i will alert you when i resolve this problem!!!!

@francyfre
Copy link

@rom1v
ThankYouVeryMuch Romain... i solve all my problem... with your help i understand that i have installed one software to deploy screen of windows over android tablet (https://www.splashtop.com/wiredxdisplay).... this software turn on his version of ADB and make "casino" with androdiStudio version!!
thank..... i need to upgrade my capacity to understand ;)

@elafefy11
Copy link

fixed this by doing the following:

going into GenyMotion settings -> ADB tab,
instead of Use Genymotion Android tools (default), I chose Use custom Android SDK Tools and then browsed to my installed SDK.

@tekle12
Copy link

tekle12 commented Sep 17, 2019

thanks very much it works correctly!! it takes me a minute

@yish-mael
Copy link

still doesnt work for me on ubuntu.

@rom1v
Copy link
Collaborator

rom1v commented Sep 18, 2019

@toles04 What is your exact error message?

adb version
which adb
echo $PATH
echo $ADB

?

@ebarlotta
Copy link

It work for me

  1. adb version
    Android Debug Bridge version 1.0.39
    Version 1:8.1.0+r23-5
    Installed as /usr/lib/android-sdk/platform-tools/adb
  2. adb kill-server
  3. ps ax | grep adb
    12290 ? S 0:00 /home/usuario/Android/Sdk/platform-tools/adb devices -l
    12291 ? Ssl 0:00 adb -L tcp:5037 fork-server server --reply-fd 7
    12332 pts/1 S+ 0:00 grep --color=auto adb
  4. cd /home/usuario/Android/Sdk/platform-tools
  5. mv adb adbxxx
  6. ln -s /usr/lib/android-sdk/platform-tools/adb adb
  7. Restart Android Studio

@jonnimoura
Copy link

Hi, what worked for me.

My Android Studio has an adb file inside /home/myuser/Android/Sdk/platform-tools/ and with the version 1.0.41.

Note where I put myuser could be your name, whatever, just locate your Android path.

My error was:
adb server version (41) doesn't match this client (39)

When you type just adb in terminal, this command will be related with the adb archive inside /usr/bin.

So, I did these steps inside terminal:

  1. adb version
    Android Debug Bridge version 1.0.39
  2. cd /usr/bin
  3. sudo rm adb
  4. cd /home/myuser/Android/Sdk/platform-tools/
  5. Please check if there is an adb file inside your path
  6. Now copy to /usr/bin
    sudo cp adb /usr/bin
  7. adb version again
    Android Debug Bridge version 1.0.41

With this done, right now I have the same adb file to both of them, so, if in the future the SDK Manager ask to upgrade platform-tools, remember to do it again if the error back to appear.

@ebarlotta
Copy link

ebarlotta commented Apr 12, 2020 via email

@vishalv4476
Copy link

Hi,
I am getting the same issue

adb server version (31) doesn't match this client (41); killing...

Android Debug Bridge version 1.0.31
I am using linux based system
please help

@rom1v
Copy link
Collaborator

rom1v commented Apr 21, 2020

@Fohsap
Copy link

Fohsap commented May 10, 2020

I'm facing this error starting from today:

Hello. The solution for this issue is like this:

  1. Click Start. Type "path" and press {ENTER}. Press {SPACE} to open "environmental variables".
  2. Double-click "path" under User Variables.
  3. Go over all of the path entries and look for "platform-tools" directories and delete those keys.
  4. Repeat step 2 and 3 for System Variables.
  5. Restart PowerShell/cmd (this will not work in previously-opened instances, I promise).
    5b. You're probably FINISHED and can run ADB, now. But if ADB.exe is not in your path, follow the next step.
  6. Be sure that a new path has been added for whichever program has the newer version of ADB (you've probably already added a path entry). For example, if you are trying to run scrcpy, you should add the scrcpy).
  7. Thank Reptar, love thy neighbor, pay it forward, be a good guy, and remember we're all special and unique. <3

@chrsrns
Copy link

chrsrns commented May 15, 2020

Hi,
I am getting the same issue

adb server version (31) doesn't match this client (41); killing...

Android Debug Bridge version 1.0.31
I am using linux based system
please help

For Ubuntu users, the problem may be because the Snap installation method has another version of ADB different from the custom one on your machine. I had the same problem.

I would suggest building the project yourself (its not that hard trust me) after removing the Snap version from your machine. It worked for me.

@RishabhRyber
Copy link

Even I am facing the same problem of scrcpy using the adb version 39 from /snap/scrcpy/221/usr/lib/android-sdk
And my flutter is using adb version 41 from /home/rishabh/Android/Sdk/platform-tools
The problem is I can't use both scrcpy and flutter at the same time, as starting one kills the other process

INFO: scrcpy 1.13 https://github.com/Genymobile/scrcpy
adb server version (41) doesn't match this client (39); killing...

  • daemon started successfully
    /usr/local/share/scrcpy/scrcpy-server:...shed. 5.4 MB/s (27694 bytes in 0.005s)

What i want is a way to let me work on both flutter and scrcpy togather.
Thanks :)

@rom1v
Copy link
Collaborator

rom1v commented May 27, 2020

When you encounter this problem, I suggest to use a non-snap version. For example, you could build the client: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#prebuilt-server

@chrsrns
Copy link

chrsrns commented May 27, 2020

I second the non-snap installation suggestion. It worked for me previously.

@ronymesquita
Copy link

On Linux with GNOME, is possible to edit the .desktop file and set the ADB environment variable in that. Example:

Exec=env ADB=$(which adb) guiscrcpy

Another option is use the Alacarte to do this. In this case the Exec part can be omitted.

env ADB=$(which adb) guiscrcpy

scrcpy

@stari4ek
Copy link

I'd like to confirm, that the adb bundled in snap (scrcpy.adb) with scrcpy is the problem.
forcing to use system-wide adb with ADB=$(which adb) solves the issue.

I'd expect that proper implementation should prefer adb available from PATH if any, and otherwise fallback to bundled one

@rom1v
Copy link
Collaborator

rom1v commented Aug 31, 2020

I'd expect that proper implementation should prefer adb available from PATH if any, and otherwise fallback to bundled one

That's what scrcpy does (it just calls adb, so it ends up using the one in PATH).

The problem is that snap runs scrcpy in some "container", where the PATH is different.

So by setting ADB=$(which adb), you force a specific adb path, calculated from the shell (without snap "containerization").

@stari4ek
Copy link

It makes sense.
Most probably, container grabs system wide variables, while my PATH is extended for current user only (using ~/.profile)

I'd expect that Linux/Mac devs install SDK using Android Studio and it's SDK Manager, which installs Platform Tools for current user. So, they update PATH for their own user.
Obviously snap knows nothing about it.

Maybe this is worth mentioning in README for installation using snap?

@ronymesquita
Copy link

Yes, this can be many useful because this error is recurrent. Even exists an opened issue about it.

@ozzono
Copy link

ozzono commented Oct 24, 2020

The idea is to set the environment variable ADB (which is read by scrcpy).

In a shell (typically on linux), you can set the variable for a single command:

VAR=value command

On Windows, you can set it globally in Windows preferenced, but you can also set it locally:

set VAR=value
command

So:

set ADB=C:\path\to\adb.exe
scrcpy

Since I'm using linux, my solution was similar to yours.
I added the following line into my .profile:
export ADB=$HOME/Android/Sdk/platform-tools/adb

@mbfakourii
Copy link

@rom1v
please add new adb in new version

@Ragner16
Copy link

1.Ensure there is no other copy of abd in your machine.
2.Add environment variable adb.exe and give path as value
3. Run command prompt as admin

It worked for me this way!
image

@cingh-jasdeep
Copy link

Sat Sri Akal ji

I had 2 adb's in my mac

found them using FindAnyFile
and replaced android studio version in both places..
problem solved!

@hadeer97
Copy link

hadeer97 commented Sep 7, 2021

It work for me

  1. adb version
    Android Debug Bridge version 1.0.39
    Version 1:8.1.0+r23-5
    Installed as /usr/lib/android-sdk/platform-tools/adb
  2. adb kill-server
  3. ps ax | grep adb
    12290 ? S 0:00 /home/usuario/Android/Sdk/platform-tools/adb devices -l
    12291 ? Ssl 0:00 adb -L tcp:5037 fork-server server --reply-fd 7
    12332 pts/1 S+ 0:00 grep --color=auto adb
  4. cd /home/usuario/Android/Sdk/platform-tools
  5. mv adb adbxxx
  6. ln -s /usr/lib/android-sdk/platform-tools/adb adb
  7. Restart Android Studio

thanks for you , it worked will

@tekle12
Copy link

tekle12 commented Sep 8, 2021 via email

@LeonardoCalazans
Copy link

Link in Stack Overflow

Got a quick way to do it First
sudo rm /usr/bin/adb

Then
sudo ln -s /home/{{username}}/Android/Sdk/platform-tools/adb /usr/bin/adb
Fastest way to fix the issue

@hugo-zaz
Copy link

Link in Stack Overflow

Got a quick way to do it First sudo rm /usr/bin/adb

Then sudo ln -s /home/{{username}}/Android/Sdk/platform-tools/adb /usr/bin/adb Fastest way to fix the issue

Great solution

@Swordox972
Copy link

Swordox972 commented May 19, 2022

rom1v commented on 30 Jul 2019
Oh, but your problem is the reverse:

adb server version (40) doesn't match this client (41);

You correctly uses v41, but some app on your computer executes adb commands with adb v40. You must find this app and stop it 😉

In my case, I had AirDroid App installed and it uses adb. That's why I had the bug. Simply uninstall it and everything is working!

@Nikzed
Copy link

Nikzed commented Dec 15, 2022

Just to point out how you should add adb variable to your PATH
image
image

@Nikzed
Copy link

Nikzed commented Dec 15, 2022

Hi all, replace 3 files in "scrcpy" folder by their version in "platform-tools" maybe work.

I hope this will be useful !!!

it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests