How To Control Android Smartphone From Linux

How To Control Android Smartphone From Linux

A new version of Scrcpy is available to download. Now it supports physical USB keyboard simulation on Android. In this tutorial post, We are going to talk about the method to control Android smartphones from Linux using a tool called scrcpy.

How To Control Android Smartphones From Linux

Scrcpy lets you display and control your Android smartphones. It is cross-platform and is available on GNU/Linux, Windows, and macOS.

One of the important requirements 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 the 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 another option if you don’t want to build the server, you can use the prebuilt server.

READ More Relevant Stuff:  Multiple Ways To Rename Multiple Files At Once In Linux

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 plug in 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

 

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

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