![]() |
VOOZH | about |
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
Setting the ANDROID_HOME environment variable ensures that tools such as Gradle, Flutter, and other build systems can find and use the Android SDK.
Before setting up ANDROID_HOME, make sure you have these files on your laptop or pc:
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.
Download the Android SDK command-line tools.
Once downloaded, extract the archive to your preferred location.
For example:
mkdir -p ~/Android/Sdkunzip commandlinetools-linux-*.zip -d ~/Android/SdkThe SDK path is the directory where you extracted the SDK tools.
For example: ' ~/Android/Sdk '.
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.
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-toolsTo apply the changes, reload your terminal or source the '.bashrc' file:
source ~/.bashrcOR
source ~/.zshrcVerify that the `ANDROID_HOME` variable is set correctly, and run the command:
echo $ANDROID_HOMEYou should see the path to your Android SDK.
Check if the SDK tools are accessible by running:
adb --versionThis should display the version of the 'adb' tool, confirming the setup is correct.
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.