scrcpy 是开源的跨平台 android 投屏软件,项目地址:https://github.com/Genymobile/scrcpy 。
先安装 scrcpy-server
项目 release 页下载 scrcpy-server-*.jar (版本用*代替,最好下载最新版),并移动到 /usr/local/share/scrcpy/scrcpy-server.jar
(注意改名)。
snap 安装 scrcpy
sudo snap install scrcpy
运行:打开手机系统调试,连接手机数据线,在命令行输入 scrcpy
,可以用鼠标操作屏幕。
安装太慢?通过代理加速安装。
编译安装 scrcpy
- Debian, Ubuntu or Linux Mint
sudo apt install adb ffmpeg libsdl2-2.0.0 make gcc pkg-config meson ninja-build libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev
- Download and install the scrcpy server jar
Download the latest scrcpy-server-v*.jar
from the application releases page, and place it in your home folder.
sudo mkdir -p /usr/local/share/scrcpy
sudo mv scrcpy-server-v*.jar /usr/local/share/scrcpy/scrcpy-server.jar
- Download the latest scrcpy release source code and extract it in your home folder.
git clone --depth=1 https://github.com/Genymobile/scrcpy.git
cd scrcpy
meson build --buildtype release --strip -Db_lto=true -Dbuild_server=false -Doverride_server_path=/usr/local/share/scrcpy/scrcpy-server.jar
cd build
ninja
sudo ninja install
- To use scrcpy, connect your Android device to your computer via USB, then run scrcpy in a terminal
scrcpy
参考资料:https://www.linuxuprising.com/2019/03/control-android-devices-from-your.html