Wednesday, October 9, 2024

How to Install & Use ADB and Fastboot on Linux Distro 2024

ADB (Android Debug Bridge) and Fastboot are essential tools for Android developers and enthusiasts. They allow for a wide range of tasks, from installing apps and managing files to unlocking bootloaders and flashing custom ROMs. This article will guide you through installing and using these powerful tools on your Ubuntu or other Linux system.

Understanding the Difference

While both ADB and Fastboot are used for managing Android devices, they have distinct functionalities.

ADB, or Android Debug Bridge, allows communication with your Android device while it's running normally. It's used for tasks like:

  • Installing apps

  • Accessing files on your device

  • Executing shell commands

  • Debugging applications

Fastboot, on the other hand, interacts with your device in a special state, often before the operating system boots. It's mainly used for:

  • Unlocking the bootloader

  • Flashing custom ROMs and recovery images

  • Updating firmware

Getting Started: Installing ADB and Fastboot on Your Linux System

Fortunately, most modern Linux distributions include the ADB and Fastboot client packages in their repositories. Here's how to install them:

Debian, Ubuntu, Mint, Pop!_OS, etc.:

      sudo apt install adb fastboot
    

RedHat, Fedora, CentOS, AlmaLinux, etc.:

      sudo dnf install android-tools
    

Arch, Manjaro, EndeavourOS, etc.:

      sudo pacman -S android-tools
    

After installation, verify the ADB version by running the following command:

      adb --version
    

Enabling USB Debugging on Your Android Device

Before you can use ADB or Fastboot, you'll need to enable USB debugging on your Android device. This allows your computer to communicate with your device. Here's how to do it:

  1. Open your device's Settings.

  2. Navigate to About phone (or Software Information).

  3. Locate the Build number (or MIUI version for Xiaomi devices).

  4. Tap the Build number repeatedly until you see a message indicating that Developer options have been enabled.

  5. Go back to Settings and navigate to System > Advanced > Developer options.

  6. Enable USB debugging.

Connecting Your Android Device via ADB

  1. Connect your Android device to your Linux system using a USB cable.

  2. Launch the ADB server on your computer by running the following command:

      sudo adb start-server
    

  1. Your Android device should display a popup asking if you want to "Allow USB debugging". Click Allow to proceed.

  2. To verify that your device is connected, run the following command:

      adb devices
    

This should list your connected device with its serial number.

Using ADB Commands

Now that you have a connection, you can use ADB commands to manage your Android device. Here are some common commands:

  • adb install <apk_name or path/to/apk>: Installs the specified APK on your device.

  • adb uninstall <apk_name or path/to/apk>: Uninstalls the specified APK from your device.

  • adb shell: Provides access to your device's shell, allowing you to execute shell commands like ls, cd, and pwd.

  • adb shell “pm list packages -u -3”: Lists all uninstallable or removable packages on your device.

  • adb push Filename where/to/send/in/Android: Pushes a file from your computer to your device, for example, adb push sample.txt /storage/emulated/0/.

  • adb pull /path/to/file/in/Android /target: Pulls a file from your device to your computer, for example, adb pull /storage/emulated/0/sample.txt ~/.

Conclusion

ADB and Fastboot are invaluable tools for Android developers and enthusiasts. By following this guide, you've learned how to install and connect these tools on your Linux system. Now, you're equipped to unlock the full potential of your Android device, from managing files and apps to exploring custom ROMs.

Remember to always back up your data before attempting any modifications to your Android system using ADB or Fastboot.

0 comments:

Post a Comment