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:
- The Android SDK Platform Package is missing.
- 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:
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).
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.
Ensure to replace the path to the platforms-tools directory with your target value.
Run the following command:
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.
In this article, we explored the two potential causes of the “adb command not found” error and how you can resolve it.