Linux

How To Control Android Smartphone From Linux

How To Control Android Smartphone From Linux
Written by itsubuntu

In this tutorial post, We are going to talk about the method to control Android smartphone from Linux using a tool called scrcpy.

How To Control Android Smartphone From Linux

Scrcpy let you to display and control your Android smartphones. It is cross platform and is available on GNU/Linux, Windows and MacOS.

One of the important requirement for this tool is that Android smartphones must have Android 5.0 or above installed.

How To Install Scrcpy In Linux

It’s kind of technical but not so hard too.  You need to build it manually in Linux. You need adb. It is available in the Android SDK platform tools. Meanwhile, The client also requires FFmpeg and LibSDL2.

For Debian/Ubuntu Operating system

Run the following command:

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

sudo apt install openjdk-8-jdk

For Fedora Operating system

Run the following command:

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install SDL2-devel ffms2-devel meson gcc make
sudo dnf install java

 

To build the server, You need to install the Android Studio and set ANDROID_HOME to its directory.

export ANDROID_HOME=~/android/sdk

There is also an another option if you don’t want to build the server, you can use the prebuilt server.

Now, Run the following command to clone the project:

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

Now build it:

meson x --buildtype release --strip -Db_lto=true
cd x
ninja

Now, You can install scrcpy with the following command:

sudo ninja install

Now, To control Android smartphones, You need to plugin and run the following command:

scrcpy

How to run scrcpy wirelessly?

Steps to run scrcpy wirelessly:
1. Connect the device to the same Wi-Fi as your computer
2. Get your device IP address
3. Enable adb over TCP/IP on your device: adb tcpip 5555
4. Connect to your device: adb connect DEVICE_IP:5555 (replace DEVICE_IP)
5. Unplug your device
6. Run scrcpy as usual

To switch back to USB mode: adb usb

 



About the author

itsubuntu

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Dear lovely people, Welcome to itsubuntu.com

Join our mailing list to receive the freebies, tutorials, latest news and updates from our team.

You have Successfully Subscribed!