VOOZH about

URL: https://www.geeksforgeeks.org/techtips/how-to-set-androidhome-path-in-ubuntu/

⇱ How to set ANDROID_HOME path in Ubuntu? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to set ANDROID_HOME path in Ubuntu?

Last Updated : 23 Jul, 2025

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.

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:

Verifying Java installation

To check if Java is installed, run:

java -version

If 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/Sdk
unzip commandlinetools-linux-*.zip -d ~/Android/Sdk

Setting 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 ~/.bashrc

OR

nano ~/.zshrc

Add the following lines at the end of the file:

export ANDROID_HOME=~/Android/Sdk

Save 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-tools

Verifying the Configuration

1. Reloading the terminal

To apply the changes, reload your terminal or source the '.bashrc' file:

source ~/.bashrc

OR

source ~/.zshrc

2. Checking ANDROID_HOME

Verify that the `ANDROID_HOME` variable is set correctly, and run the command:

echo $ANDROID_HOME

You should see the path to your Android SDK.

3. Confirming SDK tools accessibility

Check if the SDK tools are accessible by running:

adb --version

This should display the version of the 'adb' tool, confirming the setup is correct.

👁 How-to-set-ANDROID_HOME-path-in-ubuntu-copy
set ANDROID_HOME path in Ubuntu

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.

Comment
Article Tags: