![]() |
ANDROID_HOME is an environment variable that tells our system that where the Android SDK (Software Development Kit) is located. And it is a set of tools. It sets the path to the SDK installation directory. Once set, the value does not typically change and can be shared by multiple users on the same machine, it also sets the path to the user preferences directory for tools that are part of the Android SDK and defaults to $HOME/.android/ . ![]() ANDROID_HOME PATH Importance of setting ANDROID_HOMESetting the ANDROID_HOME environment variable ensures that tools such as Gradle, Flutter, and other build systems can find and use the Android SDK. PrerequisitesBefore setting up ANDROID_HOME, make sure you have these files in your laptop or pc:
Verifying Java installationTo 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 SDK1. Obtaining the SDKDownload the Android SDK command-line tools. 2. Extracting the SDK archiveOnce 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 Variable1. Locating the SDK pathThe 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 PATHThis 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 Configuration1. Reloading the terminalTo apply the changes, reload your terminal or source the ‘.bashrc’ file: source ~/.bashrc
OR source ~/.zshrc
2. Checking ANDROID_HOMEVerify that the `ANDROID_HOME` variable is set correctly, run the command: echo $ANDROID_HOME
You should see the path to your Android SDK. 3. Confirming SDK tools accessibilityCheck if the SDK tools are accessible by running: adb --version
This should display the version of the ‘adb’ tool, confirming the setup is correct. ConclusionSetting up the `ANDROID_HOME` variable that involves downloading of the SDK, configuring environment variables, and verifying the setup. This ensures a smooth development environment for Android applications. How to set ANDROID_HOME path in Ubuntu – FAQsWhat should I do if ‘ adb ’ is not recognized as a command after setting ANDROID_HOME?
How do I update the Android SDK after setting ANDROID_HOME?
Why is my ‘ ANDROID_HOME ’ variable not persistent across terminal sessions?
|
Reffered: https://www.geeksforgeeks.org
TechTips |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 20 |