I'm using Ubuntu 20.10 and I have installed scrcpy to mirror my phone screen while creating flutter applications, but when I just open Vs code, scrcpy closes with this error :: adb server version (41) doesn't match this client (39); killing...
Solution 1: Mahbubur Rahman
Same things was happened for me in Android Studio during Flutter App development. So my solution for Android Studio running on Ubuntu 20.04 is given below:
Please do the following steps:
If you have "Android SDK Platform tools" installed then please uninstall it from "Android Studio --> Tools --> SDK Manager --> SDK Tools(Tab)"
Now, please mark "Android SDK Platform tools" from the list that is found under "SDK Tools(Tab)". The path of "SDK Tools(Tab)" is "Android Studio --> Tools --> SDK Manager --> SDK Tools(Tab)". After that, press "OK" button to install.
Then, from terminal, please type following command to check the presence of "adb" file under "Android --> Sdk --> platform-tools"
"cd /home//Android/Sdk/platform-tools/ && ls"
- After that, please remove current adb file from "/usr/bin" and then copy adb file to "/usr/bin" from "/home//Android/Sdk/platform-tools/" using following commands:
"sudo rm /usr/bin/adb && sudo cp /home//Android/Sdk/platform-tools/adb /usr/bin/"
- Finally, please restart the adb server using following commands:
"kill adb-server && start adb-server"
- Now, please check either everything is ok or not using following commands:
"adb version && adb devices"
Solution 2: Nhut Pham
this error is Conflicts between adb versions https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#conflicts-between-adb-versions
Solution is set ADB env is path to Android Sdk platform-tools adb
in Linux, you can
Solution 3: Farioso Fernando
Since you're on Linux, you can take the adb path:
1. First get your adb path.
2. Second open your terminal or terminal emulator and type: export ADB=[adb path]/adb
example: export ADB=/home/Your-User/Android/Sdk/platform-tools/adb
3. You must always run this command when restarting your terminal.
Solution 4: Javohirbek Ergashboyev
Ok I have recently found solution for this issue. Since it is impossible 2 adb work in the same time, you should use one of them. To implement this:
- open vscode
- in vscode terminal $export ADB=/home/your_username/Android/Sdk/platform-tools/adb scrcpy run this command
- Then run $scrcpy command as well. I hope it works. However you should do above steps every time you open vscode!
Solution 5: Dids
If you're using Ubuntu try this, open up your terminal:
ctrl + alt + t
First check if you have adb in your platform-tools directory.
Enter this commands to check first:
You should see adb listed in your terminal.
If yes, do not close your terminal yet, and open up another terminal:
ctrl + alt + t
cd /usr/bin- changes directory to usr/bin
sudo rm adb- this will remove adb
Now go back to your previous terminal.
sudo cp adb /usr/bin - this will copy your existing adb from platform-tools directory to usr/bin where you deleted another version of adb.
now if you run:
Terminal will show a log that you don't have adb installed.
Go back to your terminal and run:
If you don't have vim installed on your machine, enter:
sudo apt install vim
Press 'i' key on your keyboard to insert path:
ctrl + shift + v to paste it in terminal
Press 'esc' key on your keyboard and type a colon
shift + ; type x and hit 'enter' key to save.