Android - Command ADB Not Found
Android - Command ADB Not Found
October 20, 2020

You might have encountered the error Command ADB not found while working with Android applications on Ubuntu. This tutorial provides the steps to resolve this error. We can fix this error by adding the ADB to the system path by updating either the .bashrc file or /etc/profile file.

Notes: This tutorial assumes that you have already installed JDK and Android Platform Tools on your Ubuntu system. It also assumes that you know the path where Platform Tools and SDK Tools are installed. You may also follow How To Install Java 8 On Ubuntu, How To Install Java 15 On Ubuntu 20.04 LTS, How To Install OpenJDK 15 On Ubuntu 20.04 LTS, How To Install Android SDK Tools On Ubuntu 18.04, and How To Install Android SDK Tools On Ubuntu 20.04.

The directory structure should be similar as shown below where android-sdk is the ANDROID_HOME directory.

android-sdk
|----platform-tools
|----cmdline-tools
|----|----tools

Update /etc/profile File

You might be required to update your /etc/profile file to configure the JAVA_HOME path as shown below. Your Java path might be different based on your Java installation.

# Update profile 
sudo nano /etc/profile

# Add at the end

# Java 8 #JAVA_HOME=/usr/java/oracle/jdk1.8.0_261 # OpenJDK 15 #JAVA_HOME=/usr/java/openjdk/jdk-15 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH

Now press Ctrl + O and press Enter to write our change. Press Ctrl + X to exit the nano editor.

Update .bashrc File

Update .bashrc file of the user account as shown below. Update the path to your ANDROID_HOME. I have installed Android SDK Tools and Android Platform Tools at /data/tools/android-sdk.

# Update Bash
sudo nano ~/.bashrc

# Android - SDK Tools & Platform Tools export ANDROID_HOME=/data/tools/android-sdk export PATH=/data/tools/android-sdk/platform-tools:/data/tools/android-sdk/cmdline-tools/tools:/data/tools/android-sdk/cmdline-tools/tools/bin:${PATH}

# Save .bashrc

# Reload Bash
source ~/.bashrc

Notes: Replace the android sdk path based on your installation directory. In my case, I have installed Android SDK Tools and Android Platform Tools at /data/tools/android-sdk.

Now we will verify the adb and sdkmanager commands as shown below.

# Verify ADB
adb --version

# Output
Android Debug Bridge version 1.0.41
Version 30.0.4-6686687
Installed as /data/tools/android-sdk/platform-tools/adb

# Verify sdkmanager
sdkmanager --version

# Output
4.0.1

Notes: You might be required to close and re-open your terminal to verify the installation of Android Platform Tools and Android SDK Tools.

Summary

This tutorial provided the solution to the error - Command 'ADB' not found.

Write a Comment

Click on the captcha image to get new code.
Discussion Forum by DISQUS