Android

ADB Command Not Found

ADB is a suite of command-line tools that facilitates the connection and communication to an android device. ADB provides a suite of versatile tools and functionality such as installing and uninstalling applications, debugging applications, running commands with elevated privileges, access to system shell, etc.

In this article, we will understand what causes the “adb command not found” error and discuss the several methods to fix the issue.

What Causes the “ADB Command Not Found” Error?

Two major causes:

  1. The Android SDK Platform Package is missing.
  2. Incorrect path to the adb binary.

Let us discuss the potential methods of fixing the “adb command not found error”.

Keep in mind that this error occurs when running the adb command in Unix systems such as Linux and macOS.

On Windows, this error may occur when using the Bash shell provided in the Git SCM package.

Fix #1: Missing Android SDK Platform Package

One of the major causes of this error is the missing Android SDK Platform Package. Before you can run the adb command, you need to ensure that you have the necessary prerequisites installed in your system.

To resolve the error, you can install the SDK Platform Tools as shown in the following steps:

Step 1: Start by downloading the SDK Platform Tools for your system in the following resource provided:

https://developer.android.com/studio/releases/platform-tools

Step 2: Once downloaded, extract the zip file into a specific location.

NOTE: You need the read/write permissions on the specified directory.

On Windows, you can extract the tools in the C:\ directory.

For macOS and Linux users, you can use the home or /opt directory.

For Windows users.

For Unix users.

After extraction, you should have a file and directory list as shown in the previous illustration.

Step 3: Once extracted, we can add the path to the extracted folder to the system’s path. This allows us to access the binaries in the platform-tools directory from anywhere in the system.

On Windows, open the Windows search and enter “Environment Variables.”

Find the “Advanced Tab” in the system properties window.

Next, select “Environment Variables” to view and edit.

In the System Variables section, choose the Path and choose the Edit button.

To add a new value in the path variable, choose the New button in the “Edit Environment Variable” window.

Set the value as the path to the platform-directory (absolute path).

For example: C:\platform-tools

Click on OK to save. You can then reload your command prompt to access the adb command.

On Windows and macOS, run the following command to add the platform-tools directory to your system’s path.

export PATH= ~/platform-tools:$PATH

Ensure to replace the path to the platforms-tools directory with your target value.

Run the following command:

$ source .bashrc

The previous command should reload the environment variables.

Fix #2: Incorrect Path to the ADB Binary

If you have downloaded and extracted the platform-tools and still facing the “adb command not found” error, you need to add the path to the platform-tools directory in your system path.

Check the instructions provided in the previous examples to learn more.

Conclusion

In this article, we explored the two potential causes of the “adb command not found” error and how you can resolve it.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list