2017-12-12 14:54:33 +00:00
|
|
|
# ScrCpy
|
|
|
|
|
|
|
|
This project displays screens of Android devices plugged on USB in live.
|
|
|
|
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
|
|
|
### Runtime requirements
|
|
|
|
|
2018-02-05 11:12:08 +00:00
|
|
|
This projects requires _FFmpeg_, _LibSDL2_, _LibSDL2-image_ and _LibSDL2-net_.
|
2017-12-12 14:54:33 +00:00
|
|
|
|
|
|
|
#### Linux
|
|
|
|
|
|
|
|
Install the packages from your package manager. For example, on Debian:
|
|
|
|
|
2018-02-05 11:12:08 +00:00
|
|
|
sudo apt install ffmpeg libsdl2-2.0.0 libsdl2-image-2.0.0 libsdl2-net-2.0.0
|
2017-12-12 14:54:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
#### Windows
|
|
|
|
|
|
|
|
From [MSYS2]:
|
|
|
|
|
|
|
|
pacman -S mingw-w64-x86_64-SDL2
|
2018-02-05 11:12:08 +00:00
|
|
|
pacman -S mingw-w64-x86_64-SDL2_image
|
2017-12-12 14:54:33 +00:00
|
|
|
pacman -S mingw-w64-x86_64-SDL2_net
|
|
|
|
pacman -S mingw-w64-x86_64-ffmpeg
|
|
|
|
|
|
|
|
[MSYS2]: http://www.msys2.org/
|
|
|
|
|
|
|
|
|
|
|
|
#### MacOS
|
|
|
|
|
|
|
|
TODO
|
|
|
|
|
|
|
|
|
|
|
|
## Build
|
|
|
|
|
|
|
|
The project is divided into two parts:
|
|
|
|
- the server, running on the device (in `server/`);
|
|
|
|
- the client, running on the computer (in `app/`).
|
|
|
|
|
|
|
|
The server is a raw Java project requiring Android SDK. It not an Android
|
|
|
|
project: the target file is a `.jar`, and a `main()` method is executed with
|
|
|
|
_shell_ rights.
|
|
|
|
|
|
|
|
The client is a C project using [SDL] and [FFmpeg], built with [Meson]/[Ninja].
|
|
|
|
|
|
|
|
The root directory contains a `Makefile` to build both parts.
|
|
|
|
|
|
|
|
[sdl]: https://www.libsdl.org/
|
|
|
|
[ffmpeg]: https://www.ffmpeg.org/
|
|
|
|
[meson]: http://mesonbuild.com/
|
|
|
|
[ninja]: https://ninja-build.org/
|
|
|
|
|
|
|
|
|
|
|
|
### Build requirements
|
|
|
|
|
|
|
|
Install the [Android SDK], the JDK 8 (`openjdk-8-jdk`), and the packages
|
|
|
|
described below.
|
|
|
|
|
|
|
|
[Android SDK]: https://developer.android.com/studio/index.html
|
|
|
|
|
|
|
|
|
|
|
|
#### Linux
|
|
|
|
|
|
|
|
sudo apt install make gcc openjdk-8-jdk pkg-config meson zip \
|
|
|
|
libavcodec-dev libavformat-dev libavutil-dev \
|
2018-02-05 11:12:08 +00:00
|
|
|
libsdl2-dev libsdl2-image-dev libsdl2-net-dev
|
2017-12-12 14:54:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
#### Windows
|
|
|
|
|
|
|
|
Install these packages:
|
|
|
|
|
|
|
|
pacman -S mingw-w64-x86_64-make
|
|
|
|
pacman -S mingw-w64-x86_64-gcc
|
|
|
|
pacman -S mingw-w64-x86_64-pkg-config
|
|
|
|
pacman -S mingw-w64-x86_64-meson
|
|
|
|
pacman -S zip
|
|
|
|
|
|
|
|
Java 8 is not available in MSYS2, so install it manually and make it available
|
|
|
|
from the `PATH`:
|
|
|
|
|
|
|
|
export PATH="$JAVA_HOME/bin:$PATH"
|
|
|
|
|
2018-01-18 16:24:38 +00:00
|
|
|
|
2018-02-04 11:17:34 +00:00
|
|
|
### Build
|
2017-12-12 14:54:33 +00:00
|
|
|
|
|
|
|
Make sure your `ANDROID_HOME` variable is set to your Android SDK directory:
|
|
|
|
|
|
|
|
export ANDROID_HOME=~/android/sdk
|
|
|
|
|
|
|
|
From the project root directory, execute:
|
|
|
|
|
2018-02-04 11:17:34 +00:00
|
|
|
make build
|
2017-12-12 14:54:33 +00:00
|
|
|
|
2018-02-04 11:17:34 +00:00
|
|
|
To run the build:
|
|
|
|
|
|
|
|
make run
|
|
|
|
|
|
|
|
It is also pass arguments to `scrcpy` via `make`:
|
|
|
|
|
|
|
|
make run ARGS="-p 1234"
|
|
|
|
|
|
|
|
The purpose of this command is to execute `scrcpy` during the development.
|
2017-12-12 14:54:33 +00:00
|
|
|
|
|
|
|
|
2018-01-18 16:24:38 +00:00
|
|
|
### Test
|
|
|
|
|
|
|
|
To execute unit tests:
|
|
|
|
|
|
|
|
make test
|
|
|
|
|
|
|
|
The server-side tests require JUnit 4:
|
|
|
|
|
|
|
|
sudo apt install junit4
|
|
|
|
|
|
|
|
|
2018-02-04 11:17:34 +00:00
|
|
|
### Generate a release
|
|
|
|
|
|
|
|
From the project root directory, execute:
|
|
|
|
|
|
|
|
make release
|
|
|
|
|
|
|
|
This will generate the application in `dist/scrcpy/`.
|
|
|
|
|
|
|
|
|
2017-12-12 14:54:33 +00:00
|
|
|
## Run
|
|
|
|
|
2018-01-18 16:24:38 +00:00
|
|
|
Plug a device, and from `dist/scrcpy/`, execute:
|
2017-12-12 14:54:33 +00:00
|
|
|
|
|
|
|
./scrcpy
|
|
|
|
|
|
|
|
If several devices are listed in `adb devices`, you must specify the _serial_:
|
|
|
|
|
|
|
|
./scrcpy 0123456789abcdef
|
|
|
|
|
|
|
|
To change the default port (useful to launch several `scrcpy` simultaneously):
|
|
|
|
|
|
|
|
./scrcpy -p 1234
|
2018-02-04 11:17:34 +00:00
|
|
|
|
|
|
|
Other options are available, check `scrcpy --help`.
|