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
1 2 3 |
mkdir -p ~/edev/sandbox cd ~/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:
1 2 |
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):
1 2 |
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:
1 |
deb http://archive.ubuntu.com/ubuntu/ xenial-proposed restricted main multiverse universe |
before installing it:
1 2 |
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:
1 2 3 4 5 |
pushd /opt sudo unzip android-studio-ide-171.4443003-linux.zip cd android-studio/bin export ANDROID_HOME=~/opt/android-studio/ ./studio.h |
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:
1 2 3 4 5 6 7 |
popd wget https://github.com/Genymobile/scrcpy/releases/download/v1.0/scrcpy-server-v1.0.jar 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 cd x ninja 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:
1 2 3 |
adb devices List of devices attached 9c6b9b8e device |
Time to start the program, simply type:
1 |
scrcpy |
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!
Via Liliputing and Reddit
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
wow, thanks for posting, didn’t know that program.
it’s currently segfaulting here after some seconds, but anyway very promising!
If device is rooted, usb debugging enabled (that’s mandatory for Lollipop and newer I think) and you use some app like WiFi ADB (https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb) I assume it could work over wifi/ethernet.
In that scenario it should work with:
adb connect
scrcpy
@Stane1983
No, it do not works over wifi-adb, prints: ‘error more than once device/emulator”, ERROR: “adb reverse” returned with value 1’. All is ok over cable even youtube.
And no UTF8 input – unusable for me because of this
@Sfinx
File an issue on their issue tracker or even better create a pull request (PR). Rebember it’s Open Source Software 🙂
@Sfinx
File an issue on their issue tracker or even better create a pull request (PR). Remember it’s Open Source Software 🙂
@Sfinx
There’s an issue that may be related on Github: https://github.com/Genymobile/scrcpy/issues/37
also see
After installing scrcpy on two Ubuntu 16.04 (64 bit) I tried to simplify the (installation) process in order to deploy scrcpy on many machines at job. Using the scrcpy and scrcpy-server.jar generated binaries I done: sudo cp -p scrcpy /usr/local/bin/. sudo chmod 755 /usr/local/bin/scrcpy sudo chown root:root /usr/local/bin/scrcpy sudo mkdir /usr/local/share/scrcpy sudo chmod 755 /usr/local/share/scrcpy sudo chown root:root /usr/local/share/scrcpy sudo cp -p scrcpy-server.jar /usr/local/share/scrcpy/. sudo chmod 644 /usr/local/share/scrcpy/scrcpy-server.jar sudo chown root:root /usr/local/share/scrcpy/scrcpy-server.jar And I installed also the adb (Android Device Bridge) Ubuntu package: sudo apt-get update sudo apt-get install adb I put these steps on a script and that’s all!… Read more »
scrcpy is now available as a snap (unofficial):