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...
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...
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
/home//Android/Sdk/platform-tools/adb
in Linux, you can
export ADB=/path/to/your/adb
in Win,
set ADB=/path/to/your/adb
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:
Solution:
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"
"sudo rm /usr/bin/adb && sudo cp /home//Android/Sdk/platform-tools/adb /usr/bin/"
"kill adb-server && start adb-server"
"adb version && adb devices"
Since you're on Linux, you can take the adb path:
1. First get your adb path.
example: /home/Your-User/Android/Sdk/platform-tools/adb
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.
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:
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:
cd /home/change-this-to-your-username/Android/Sdk/platform-tools/
ls
You should see adb listed in your terminal.
If yes, do not close your terminal yet, and open up another terminal: ctrl + alt + t
Enter command:
cd /usr/bin - changes directory to usr/bin
sudo rm adb - this will remove adb
Now go back to your previous terminal.
Enter command:
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: scrcpy
Terminal will show a log that you don't have adb installed.
Go back to your terminal and run: vim .bashrc
If you don't have vim installed on your machine, enter:
sudo apt install vim
Press 'i' key on your keyboard to insert path: export ADB='/usr/bin/adb'
ctrl + shift + v to paste it in terminal
Press 'esc' key on your keyboard and type a colon : or shift + ; type x and hit 'enter' key to save.
run: scrcpy