Android Open Source Tool For A Remote Screen over USB

One of the main issues I have with tablets and smartphones is that I did not come across a good tool for remote support, i.e. seeing the screen on my PC and being able to use the mouse and the keyboard to interact with the system. Yes, I know there some apps such as Teamviewer but they are not open source so my trust in them is very limited. Finally, however, I’ve been made aware of an interesting tool that can partly do the job: Scrcpy by Genymobile!

Scrcpy is available on Github and exports the screen of an Android device over USB to Linux, Windows or Mac. No root rights are required on the device, only USB debugging must be enabled. While the Windows version of the viewer comes as a ready to run executable that runs fine on a Windows 10 system I run in a virtual machine, the Linux version of the viewer has to be compiled. There are instructions on the Github page on how to do that which require some fine tuning depending on the Linux operating system and version you are using. I’ll paste my streamlined list of commands to get things working for Ubuntu 16.04 below. With these commands it is pretty much straight forward and things are installed in just a few minutes.

While scrcpy runs well on Ubuntu 16.04 on a PC, I had a strange graphical effect on the same Ubuntu 16.04 and also 18.04 running in a virtual machine, I could only see the upper left half of the screen while the lower right part of the screen was black. A bit strange.

Obviously exporting the screen and being able to control the Android device with the mouse and keyboard locally is only 50% of the job, it doesn’t give me remote control of the device over the Internet. True, but for this I use VNC to the remote PC to which the Android device is connected to over USB. And, also true, that is far less elegant than using other tools that work without this indirection but it’s under an open source license and at least after a very superficial inspection it seems like it does not exfiltrate any kind of data.

A great first step that perhaps somebody will use to create a open source solution that works over the Internet as well without the help of an additional PC! Thank you Genymobile for open sourcing this!

And here’s my list of commands to compile and set-up the Linux client:

# Compiles and Installs scrcpy on Ubuntu 16.04

sudo apt install android-tools-adb git ffmpeg libsdl2-2.0.0 openjdk-8-jdk python3-pip wget

sudo apt install make gcc pkg-config meson ninja-build libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev
                               
pip3 install meson

git clone https://github.com/Genymobile/scrcpy

cd scrcpy/server

# Download the server part that is pushed to the UE into the scrcpy 'server' folder
wget  https://github.com/Genymobile/scrcpy/releases/download/v1.7/scrcpy-server-v1.7.jar  

cd ..

~/.local/bin/meson x --buildtype release --strip -Db_lto=true -Dprebuilt_server=scrcpy-server-v1.7.jar

cd x
ninja

sudo ninja install

# Done, now scrcpy can be started from any directory

cd ~
scrcpy