Have you ever wished you could control or mirror your Android smartphone using your computer? Scrcpy, a free and open source program by Genymotion may fit your needs, and works on Windows, Mac OS or Linux. You just need to install (or build) a program on your host computer, connect your phone via USB, switch to developer mode, enable USB debugging, and run the program which will automatically install the server (a jar file) on your phone, which does not need to be rooted.
The easiest way to try is with Windows since the developers already provide pre-built binaries, but I installed it on Ubuntu 16.04 instead since it is the operating system I use daily. Some of the packages in Ubuntu 16.04 are a bit old so it took me a couple of hours to successfully install it, and I’d recommend going with Ubuntu 17.10 or 18.04 daily build if you can.
First let’s create a working directory, and retrieve the source code
mkdir –p ~/edev/sandbox
git clone https://github.com/Genymobile/scrcpy
We also need to install some dependencies to run (first line) and build (second) the program:
sudo apt install ffmpeg libsdl2–2.0.0
sudo apt install make gcc openjdk–8–jdk pkg–config zip libavcodec–dev libavformat–dev libavutil–dev
The original instructions for Debian also list meson and libsdl2-dev, but Meson 0.29 is installed in Ubuntu 16.04, and we need version 0.37 or greater. So I used pip to install the most recent version (0.45):
sudo apt remove meson
sudo pip3 install meson
libsdl2-dev refused to install too, and I had to enable xenial-proposed in /etc/apt/sources.list:
deb http://archive.ubuntu.com/ubuntu/ xenial–proposed restricted main multiverse universe
before installing it:
sudo apt update
sudo apt install libsdl2–dev
Those two problems should not occur in more recent versions of Ubuntu.
We are also supposed to install the Android SDK, but it’s only if you plan to build the server part, and it’s optional. I leave the steps I followed, but feel free to skip that part.
Download, install, and launch Android Studio:
sudo unzip android–studio–ide–171.4443003–linux.zip
Download the latest Android SDK in the Android Studio SDK, and accept the license agreement.
That’s the important bit, or the build will fail. However in my case, it still failed… as there’s a mismatch between the expect version (26.0.2) and my version (26.1.1).
You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 26.0.2, Android SDK Platform 27].
I have not looked into a fix that long, once I realized there was a prebuilt server (the binary that needs to be copied to the phone), and only built the Linux app:
mv scrcpy–server–v1.0.jar server
meson x —buildtype release —strip –Db_lto=true –Dprebuilt_server=/home/jaufranc/edev/sandbox/scrcpy/scrcpy–server.jar
sudo ninja install
scrcpy should be installed in your path now. Make sure your phone is connected over adb, and USB debugging is enabled in your phone in the Developer Options.
You may now optionally want to open a terminal to check your phone is detected:
List of devices attached
Time to start the program, simply type:
Within a few second you should see your phone display appear on your desktop… 🙂
You can control the display with your mouse and keyboard, and the window is fairly responsive, although not always extra smooth at all time. This may vary with the phone and computer used. It also a way to mirror your phone on a large screen using the touchscreen for control. Apart from applications or actions requiring multi-touch, I could do anything I want to the mouse and keyboard, send SMS, chat, browser the web, play games, etc…
Landscape mode is also working, and the window will automatically switch following your phone’s orientation.
The window can also be maximized. Not quite full size, but close to it… Audio is still going through the phone speakers.
There are no software button for Home, Back, and App Switch, so you may want to learn a few screenshot to fully utilize the capabilities of the program:
switch fullscreen mode Ctrl+f
resize window to 1:1 (pixel-perfect) Ctrl+g
resize window to remove black borders Ctrl+x
click on HOME Ctrl+h
click on BACK Ctrl+b
click on APP_SWITCH Ctrl+m
click on VOLUME_UP Ctrl++
click on VOLUME_DOWN Ctrl+-
click on POWER Ctrl+p
turn screen on Right-click
paste computer clipboard to device Ctrl+v
enable/disable FPS counter (on stdout) Ctrl+i
FPS Counter? Interesting. I enabled it while panning and zoom-in and out in MAPS.ME app.
The frame rate dropped to around 30 fps with some frames skipped from time to time, so not perfectly, but still not too bad. Give it a try!