Setting up the ANDROID_HOME path in Ubuntu is a crucial step for Android development. This environment variable points to the location of the Android SDK, enabling development tools to access necessary files and binaries. In this guide, we'll walk you through the process of configuring ANDROID_HOME on Ubuntu, including how to set the Android SDK path on Ubuntu and properly set up your Ubuntu Android SDK path. By following these instructions, you'll ensure a smooth setup for your Android development environment.
Table of Content
- Importance of setting ANDROID_HOME
- Prerequisites
- Verifying Java installation
- Downloading Android SDK
- 1. Obtaining the SDK
- 2. Extracting the SDK archive
- Setting Up ANDROID_HOME Environment Variable
- 1. Locating the SDK path
- 2. Adding ANDROID_HOME to ' .bashrc ' or ' .zshrc '
- 3. Adding platform-tools to PATH
- Verifying the Configuration
- How to set ANDROID_HOME path in Ubuntu - FAQs
Importance of setting ANDROID_HOME
Setting the ANDROID_HOME environment variable ensures that tools such as Gradle, Flutter, and other build systems can find and use the Android SDK.
Prerequisites
Before setting up ANDROID_HOME, make sure you have these files on your laptop or pc:
- Check, If Java Development Kit (JDK) is installed.
- A terminal application.
Verifying Java installation
To check if Java is installed, run:
java -versionIf Java is not installed, follow the instructions on installation of JDK to install it. Then again run the command on cmd.
Downloading Android SDK
1. Obtaining the SDK
Download the Android SDK command-line tools.
2. Extracting the SDK archive
Once downloaded, extract the archive to your preferred location.
For example:
mkdir -p ~/Android/Sdkunzip commandlinetools-linux-*.zip -d ~/Android/SdkSetting Up ANDROID_HOME Environment Variable
1. Locating the SDK path
The SDK path is the directory where you extracted the SDK tools.
For example: ' ~/Android/Sdk '.
2. Adding ANDROID_HOME to ' .bashrc ' or ' .zshrc '
Open your '.bashrc' (or '.zshrc' if you use Zsh) file in a text editor:
nano ~/.bashrcOR
nano ~/.zshrcAdd the following lines at the end of the file:
export ANDROID_HOME=~/Android/SdkSave and close the file.
3. Adding platform-tools to PATH
This ensures that the platform-tools directory, which contains Android Debugger Bridge( 'adb' ) and other essential tools, is included in your system's 'PATH'.
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-toolsVerifying the Configuration
1. Reloading the terminal
To apply the changes, reload your terminal or source the '.bashrc' file:
source ~/.bashrcOR
source ~/.zshrc2. Checking ANDROID_HOME
Verify that the `ANDROID_HOME` variable is set correctly, and run the command:
echo $ANDROID_HOMEYou should see the path to your Android SDK.
3. Confirming SDK tools accessibility
Check if the SDK tools are accessible by running:
adb --versionThis should display the version of the 'adb' tool, confirming the setup is correct.

Conclusion
Properly configuring the ANDROID_HOME environment variable on Ubuntu is essential for effective Android development. By learning how to set ANDROID_HOME on Ubuntu, you'll be able to streamline your development process and ensure that all tools have access to the necessary SDK components. Regularly verifying and updating your ANDROID_HOME configuration on Ubuntu will help maintain a reliable and efficient development setup.