Troubleshooting Guide: How to Connect and Load an Android Device in Android Studio on Linux

Context:

I’m a dedicated Linux user—not just for managing home network servers, but also as my primary operating system on my laptop, running Ubuntu Desktop. From the moment I began using Linux and exploring its command-line operations, I was captivated by its mechanical elegance—almost like something out of a sci-fi film.

But beyond the aesthetic appeal, the command line offers a level of speed and efficiency that simply outperforms traditional graphical interfaces.

Having worked professionally as a shell script developer two years ago, Linux has become second nature to me—something I rely on as effortlessly as breathing. While there’s always more to learn and explore within this powerful operating system, I truly can’t imagine life without it.

In this article, I’ll be discussing how to troubleshoot issues when Android Studio fails to recognize your Android device on a Linux machine.

I’m fully aware that developing Android apps on a Linux desktop is still a niche area. However, with Linux’s market share steadily growing, this topic may become increasingly relevant in the near future—especially for those who may choose Linux as their development environment. If you ever find yourself developing Android apps on Linux, this guide could prove to be quite useful.

Additionally, most of the troubleshooting steps I present here are not exclusive to Linux—they’re also applicable to other operating systems like Windows and macOS. While the focus is on Linux, many of the underlying principles and solutions are universal across platforms.

My environment

Android:

Device name: Pixel 3a XL

OS: Pixel Experience (Android 13)

Linux:

Device manufacture: System 76

Model: Galago Pro (2018)

OS: Ubuntu 24.04.2 LTS

Option 1: Verify USB Debugging is Enabled

First and foremost, ensure that USB debugging is enabled. While this may seem like a very basic step, it’s something people often overlook.

If you don’t see Developer options, enable them first:

Go to SettingsAbout phone.

Tap Build number seven times to activate developer mode.

Option 2: Restart ADB

Open a terminal in Android Studio and restart ADB:

adb kill-server
adb start-server

Check if your device now appears listed.

Option 3: Restart ADB Server

adb kill-server
adb start-server

Then, reconnect your device.

Option 4: Check Connection Mode on Device

Connect your device via USB.

On the Android notification shade, verify it’s set to “File transfer (MTP)” or “PTP”, rather than “Charging only.”

Option 5: Check for Physical Connection Issues

Try another USB port.

Change your USB cable.

Ensure your cable supports data transfer, not just charging.

Option 6: Restart Android Studio and Device

Sometimes simply restarting both your device and Android Studio resolves the issue.

Option 7: Check udev Rules (Linux-specific)

On Ubuntu, ensure you have the correct USB permissions:

sudo apt install android-sdk-platform-tools
sudo usermod -aG plugdev $USER

Create a udev rule to ensure the device is recognized properly:

Create or edit the file:

sudo vim /etc/udev/rules.d/51-android.rules

Add the following line (replace 18d1 with your device’s vendor ID if different):

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo service udev restart

Apply rules:

You can find your Vendor ID by running:

lsusb

Restart adb server.

adb kill-server
adb start-server
adb devices

About vendor ID:

Just in case, here is a list of major Android manufacturers’s vendor IDs.

ManufacturerUSB Vendor ID
Google (Pixel/Nexus)18d1
Samsung04e8
Huawei12d1
Xiaomi2717
OnePlus2a70 or 05c6
Sony054c
Motorola22b8
LG1004
HTC0bb4
ASUS0b05
Oppo22d9
Vivo2d95

How to find Vendor ID yourself using lsusb:

Connect your Android device and run:

lsusb

It will output something like:

Bus 001 Device 005: ID 18d1:4ee7 Google Inc.

The part after ID (18d1) is your Vendor ID.

Afterthoughts:

As I’ve outlined here, by utilizing Linux commands and editing system files, you gain deeper access to the inner workings of the Linux system—skills that can truly set you apart from the crowd.

In my case, I’ve developed Android apps on both Windows and Linux, so it’s been essential for me to become familiar with both environments. This versatility not only enhances my workflow but also strengthens my adaptability as a developer.

Leave a Reply

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