Implementation premise: ensure that adb has been installed successfully, if not, you can refer to https://blog.csdn.net/qq_33575901/article/details/103954723 to install adb
1. Installation dependencies
sudo apt install ffmpeg libsdl2-2.0-0
sudo apt install make gcc git pkg-config meson ninja-build libavcodec-dev libavformat-dev libavutil-dev
sudo apt install openjdk-8-jdk
2. Download server
https://github.com/Genymobile/scrcpy/releases/download/v1.12.1/scrcpy-server-v1.12.1 , which will be used later
3. Use open source projects
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
meson x --buildtype release --strip -Db_lto=true
cd x
ninja
The last step of running ninja may fail, but you can find that the error was found when building the server. At this time, you need to use the server downloaded in step 2, rename scrcpy-server-v1.12.1 to scrcpy-server, and move Just go to the server directory in the x directory.
4. Use cast screen
1) Turn on the USB debugging mode of the Android phone and connect it to the computer
2)./run x
The following renderings: