How to Install ADB on Linux [2 Best Methods]

TL;DR

To learn how to install ADB on Linux, you can follow these steps:

  1. Enable USB debugging on your Android device by going to Settings > About phone > Version number (tap 7 times) > Developer options.
  2. Update your package list with the sudo apt update command.
  3. Install ADB Linux using sudo apt install adb and follow the on-screen instructions to complete the installation.
  4. Connect your Android device to your Linux machine via USB, allow USB debugging from the prompt on your device, and verify the ADB installation with adb devices.

If you’ve ever struggled with managing your Android device from your Linux computer, you’re in the right place. ADB (Android Debug Bridge) is the solution you need, and this guide will help you install ADB on Linux. I’ll walk you through the entire process, from installation to troubleshooting common issues. By the end, you’ll be able to control your Android device, transfer files, and debug apps directly from your Linux system. Let’s explore and make your Android development easier and more efficient!

What is ADB?

ADB (Android Debug Bridge) is a tool that allows you to communicate with your Android device from your computer. Think of it as a bridge that connects your computer to your Android phone or tablet, enabling you to control the device, transfer files, install apps, and perform various other tasks directly from your computer. It’s an essential tool for Android developers, testers, and anyone who wants to manage their device more efficiently.

Key Features of ADB

ADB is packed with features that make it a powerful tool for managing and developing Android devices. Here are some of the key features:

  • Remote Debugging: ADB allows you to debug apps running on your device from your computer. This is essential for developers who need to troubleshoot and fix issues in their apps.
  • Multiple Device Support: You can connect multiple devices to your computer and use ADB to manage them all simultaneously. This is helpful for developers testing their apps on different devices.
  • Fast and Efficient: ADB is designed to be fast and efficient, allowing you to execute commands quickly and get immediate feedback. This improves productivity, especially when performing repetitive tasks.
  • Broad Compatibility: ADB works with a wide range of Android devices and versions. Whether you have a phone, tablet, or even a smartwatch, you can use ADB to manage it.
  • Customizable: You can extend ADB’s functionality with custom scripts and commands. This allows you to tailor ADB to your specific needs and automate complex workflows.

How to Install ADB on Linux?

To install ADB on Linux, update your package list with sudo apt update, then install ADB using sudo apt install adb. Verify the installation with adb devices. It will show the installed version of ADB, confirming the installation was successful.

1. Installing Using APT Package

Ubuntu and Debian-based distributions use the APT (Advanced Package Tool) package manager, which simplifies software installation. Using APT to install ADB ensures you get a stable, well-tested version directly from the official repositories.

  1. Before installing any new software, it’s good practice to update the package list to ensure you get the latest version available in the repository.
sudo apt update
updating system package list 4
  1. Use the apt command to install the adb package. This command will download and install ADB along with any necessary dependencies.
sudo apt install adb
installing adp using apt
  1. After the installation completes, you should verify that ADB is installed correctly and check its version.
adb version

This command should output the installed version of ADB, confirming that the installation was successful.

verifying adb installation

2. Installing ABD Manually

  1. Open the Settings app on your Android device.
go to mobile settings
  1. Scroll down and select About phone.
click on about device option
  1. Click on the Versions option. 
tap on version option
  1. Tap on Version number 7 times to enable Developer options.
entering developer mode
  1. Go back to Settings search for Developer options and click on it.
opening developer options
  1. Toggle on USB debugging.
enabling usb debugging

Now it’s time to install ADB tools on Ubuntu.

  1. Open a terminal.
open terminal
  1. To update your package list, run the command:
sudo apt update

This command updates the list of available packages and their versions, but it doesn’t install or upgrade any packages.

updating package list 1
  1. Run the following command to install ADB:
sudo apt install adb

Follow the on-screen instructions to complete the installation.

installing adb on ubuntu
  1. Connect your Android device to your Linux machine using a USB cable.
  2. On your device, if you see a prompt asking to allow USB debugging from your computer, tap OK.
device connected to system via USB
  1. To verify that ADB is correctly installed and working, you can run:
adb devices

This command should list the connected devices. If your device is listed, you’ve successfully set up ADB on your Linux system.

verifying adb installations

Advanced Operations Using ADB Tools on Linux

Master advanced ADB (Android Debug Bridge) tools on Linux to elevate your Android development and debugging. Learn to control apps, read logs, take screenshots, and much more, seamlessly. Here is the step-by-step guide to learning how to use ADB on Linux:

1. Starting ADB in Server Mode

Starting ADB in server mode establishes a communication bridge between your Linux machine and your Android device. It’s essential for executing any ADB commands. Follow these steps to do it:

  1. Open a terminal on your Linux machine and type the following command to start ADB in server mode:
adb start-server
  1. You’ll see a message indicating that the ADB server has started successfully.
starting ADB server mode

2. Installing and Uninstalling Apps via ADB

Install and uninstall apps on your Android device directly from your Linux machine, bypassing the need for on-device app installation and uninstallation methods. Here is the step-by-step guide:

Installing an App

  1. Find the APK file you wish to install on your device. Note its path.
  2. In the terminal, navigate to the directory containing the APK or use the full path in the following command:
adb install /path/to/yourApp.apk

Upon successful installation, the terminal will display a message: Success.

installing app using adb

Uninstalling an App

  1. You need the app’s package name to uninstall it. If unknown, you can list all installed packages by typing:
adb shell pm list packages

Note the app’s package name that you want to uninstall.

listing all installed packages on the device
  1. Use the app’s package name in the following command:
adb uninstall com.example.yourApp

A simple Success message will confirm the app has been uninstalled.

uninstalling an app using adb

3. Accessing Device Logs with ADB

Access real-time logs from your Android device for debugging purposes. This can help identify issues with apps or the device itself. Follow these steps to access device logs:

  1. To view real-time logs from your device, use:
adb logcat

This command displays real-time logs from your Android device, useful for debugging.

viewing real time logs of device
  1. For more specific logs, add filters. For example, to filter for errors, you can use:
adb logcat *:E

This filters the log output to show only errors, making it easier to spot issues.

filter error logs of device

4. Taking Screenshots

Quickly capture the current screen of your Android device directly to your Linux machine. Here is how to do it:

  1. To take a screenshot and save it to your computer, run the command:
adb exec-out screencap -p > screenshot.png

You’ll find screenshot.png in your current directory.

taking screenshot of device using adb

Troubleshooting Common ADB Installation and Setup Issues

When setting up ADB on Linux, you might run into a few problems like unrecognized devices to path variable issues. Here, I’ll explain five most common issues and their solutions, ensuring a smooth setup process for your Android development environment:

  • 🔌 Device Not Recognized or Unauthorized: If your device isn’t recognized, ensure the USB cable is securely connected. Switch your device to “File Transfer” mode, enable USB debugging, and authorize your computer for USB debugging when prompted.
  • 🔄 ADB Server Version Mismatch: A version mismatch between the ADB client and daemon can cause connectivity issues. Resolve this by updating your ADB tools to the latest version available, ensuring compatibility across your development environment.
  • 🔒 USB Debugging Issues: Should USB debugging disable itself or fail to respond, navigate to the Developer Options on your device and revoke all USB debugging authorizations. Then, reconnect your device and authorize it again.
  • 🚫 ‘ADB Command Not Found’ Errors: This error suggests ADB is not correctly added to your PATH. Confirm that the ADB installation directory is included in your PATH environment variable. Restart your terminal or computer to apply changes.
  • 🔧 PATH Environment Variable Problems: If ADB commands are unrecognized, revisit your .bashrc or .zshrc file for potential syntax errors. Make sure the path to the ADB directory is accurately added, with no typographical mistakes.

ADB Install Linux: Final Thoughts

To wrap up, you’ve now learned how to install ADB in Linux using package managers and manual methods. I walked you through detailed steps for different distributions and shared troubleshooting tips to ensure everything runs smoothly. Now, your Android development environment should be robust and efficient.

For further exploration, I recommend checking out articles on:

  • How to check the version of a Python package, which will help you manage dependencies and ensure compatibility in your development projects.
  • Learning how to use the help command in Linux can provide you with quick guidance on any command, improving your command line efficiency.
  • Additionally, learning how to install Python3 on Ubuntu can further expand your development capabilities by setting up a versatile programming environment.

Frequently Asked Questions

  1. What is ADB sideloading, and how do I use it?

    ADB sideloading allows installing ZIP files from a computer to an Android device via ADB, often for firmware updates without recovery mode. Initiate it by entering adb sideload <filename.zip> while your device is in recovery mode.

  2. How can I access and modify the shared preferences of an app via ADB?

    To access and modify an app’s shared preferences, use adb pull to download the preferences file and adb push to upload it after editing. This process typically requires root access for the app’s preferences to be modified.

  3. Is it possible to use ADB over WiFi, and how?

    Using ADB over WiFi is possible by first connecting the device via USB and running adb tcpip 5555. Afterward, disconnect USB and connect through IP address using adb connect <device_ip_address>. An initial USB connection is needed for security.

  4. Is there a way to change app settings directly through ADB?

    Changing app settings directly is feasible with ADB using adb shell settings put <namespace> <key> <value>. This command modifies global, secure, and system settings, offering a powerful way to adjust app behaviors and system functionalities, but it should be approached with caution.

Ojash

Author

Ojash is a skilled Linux expert and tech writer with over a decade of experience. He has extensive knowledge of Linux's file system, command-line interface, and software installations. Ojash is also an expert in shell scripting and automation, with experience in Bash, Python, and Perl. He has published numerous articles on Linux in various online publications, making him a valuable resource for both seasoned Linux users and beginners. Ojash is also an active member of the Linux community and participates in Linux forums.

Akshat

Reviewer

Akshat is a software engineer, product designer and the co-founder of Scrutify. He's an experienced Linux professional and the senior editor of this blog. He is also an open-source contributor to many projects on Github and has written several technical guides on Linux. Apart from that, he’s also actively sharing his ideas and tutorials on Medium and Attirer. As the editor of this blog, Akshat brings his wealth of knowledge and experience to provide readers with valuable insights and advice on a wide range of Linux-related topics.

Share this article
Shareable URL
Prev Post

How to Create Home Directory for User Linux [10 Easy Steps]

Next Post

How To Copy Directory on Linux [4 Best Methods]

Leave a Reply

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

Read next