Address
304 North Cardinal St.
Dorchester Center, MA 02124

Work Hours
Monday to Friday: 7AM - 7PM
Weekend: 10AM - 5PM

Using Scrcpy to Mirror Android Screens

I recently learned about scrcpy, and it makes Android mirroring so much easier.

Scrcpy – Introduction

In the past, I’ve used various Chrome plugins or odd apps to try and control my Android device from my computer.

There was always the option for an emulator like BlueStacks, but that wasn’t quite what I wanted.

When searching for another way recently, I ran across scrcpy, and it was exactly what I had been looking for.

I’ve wanted something like this for Android testing/automation, or just using my phone without having to pick it up.

Installation

First, you can find everything that you will need at the GitHub repository.

I also recommend looking at the FAQ. I’ve personally run into the issue where the mouse was clicking in the wrong location, and the fix was right there.

First, I needed to install the android-platform-tools on my system.

doyler@mbp:~/tools$ brew cask install android-platform-tools
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
cargo-c                   devdash                   kind                      [email protected]          rav1e
cartridge-cli             gimme-aws-creds           liblouis                  node@12                   sentencepiece
cups                      helm@2                    monolith                  postgresql@11             trader
==> Updated Formulae

... <snip> ...

==> Linking Binary 'mke2fs' to '/usr/local/bin/mke2fs'.
 android-platform-tools was successfully installed!

I verified this installation by running the adb devices command.

doyler@mbp:~/tools$ adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
70xxxxxxxxxxxx	unauthorized

doyler@mbp:~/tools$ adb devices
List of devices attached
70xxxxxxxxxxxx	device

Next, I connected to an adb shell, to confirm that everything was working as expected.

doyler@mbp:~/tools$ adb shell
taimen:/ $ id
uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3009(readproc),3011(uhid) context=u:r:shell:s0

With the Android tools installed, I also used Homebrew to install scrcpy. Note that this requires nothing, not even root, on the target device.

doyler@mbp:~/tools$ brew install scrcpy

Usage

With everything installed, I just had to run the application and it handled everything for me.

doyler@mbp:~/tools$ scrcpy
2019-11-25 11:10:04.682 scrcpy[47767:37867866] INFO: scrcpy 1.11 <https://github.com/Genymobile/scrcpy>
/usr/local/Cellar/scrcpy/1.11/share/scrcpy/scrcpy-server: 1 file pushed. 0.9 MB/s (25454 bytes in 0.027s)
2019-11-25 11:11:06.170 scrcpy[47767:37867866] INFO: Initial texture: 1440x2880
2019-11-25 11:13:52.693 scrcpy[47767:37867866] INFO: New texture: 2880x1440
2019-11-25 11:13:53.211 scrcpy[47767:37867866] INFO: New texture: 1440x2880
2019-11-25 11:15:06.444 scrcpy[47767:37867866] WARN: Device disconnected

As you can see, I was able to control my device with my keyboard and mouse, and no additional software!

Scrcpy - Android control

Scrcpy – Conclusion

This was a simpler tool to install, but I love that about it.

I won’t be able to easily automate some things, as it would still require scripting or screen scraping. That said, this is exactly what I was looking for in the realm of connection and control.

If you have any suggestions for more Android automation, or mobile games that I should try, then definitely let me know!

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.