How to Set Android_Sdk_Home Environment Variable

how to set ANDROID_SDK_ROOT manually in windows

First of all look at your error shown:

Requirements check results for android: Java JDK: installed 14.0.2 Android SDK: not installed Failed to find 'ANDROID_SDK_ROOT' environment variable.

Cordova is still supporting Java JDK 8. So you have to uninstall other Java versions and install Java JDK 8 from here[ either Oracle Java or Open JDK]:

  1. Oracle Java - https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
  2. Open JDK 8 - https://developers.redhat.com/products/openjdk/download

After installation, set variable path like, JAVA_HOME & javac

For steps see here: https://androidabcd.info/how-to-set-java_home-in-windows-10/

You can check the java version and the javac version:

java -version
javac -version

Now you need to install Android studio to get the Android SDK. Once you get the android-sdk path, then you can set it in a variable path.

For Windows:

set ANDROID_SDK_ROOT=C:\installation location\android-sdk

set PATH=%PATH%; %ANDROID_SDK_ROOT%\tools; %ANDROID_SDK_ROOT%\platform-tools;

You can check the installation location of the sdk by opening Android Studio, on top right corner option select "SDK Manager". Then copy the sdk location.

Also, you need Gradle, and that you download Gradle binary from here and extract it in the C folder.

Set Gradle Path:

set PATH=%PATH%;C:\Gradle\gradle-7.1.1\bin;

Error: ANDROID_HOME is not set and android command not in your PATH. You must fulfill at least one of these conditions.

For Windows:

    set ANDROID_HOME=C:\ *installation location* \android-sdk

set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Taken from this installation guide.

Android SDK Environment Variables

I think the page you are looking for is Environment Variables

ANDROID_HOME

Is deprecated and you need to use ANDROID_SDK_ROOT instead. If you continue to use it, the following rules apply:
If ANDROID_HOME is defined and contains a valid SDK installation, it's value is used instead of the value in ANDROID_SDK_ROOT.
If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used.
If ANDROID_HOME is defined but, does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT is used instead.

ANDROID_SDK_ROOT

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.

ANDROID_SDK_HOME

By default, the emulator stores configuration files under $HOME/.android/ (%username%/.android/ in windows) and AVD data under $HOME/.android/avd/ (%username%/.android/avd/ in windows). You can override the defaults by setting the following environment variables. The emulator -avd <avd_name> command searches the avd directory in the order of the values in $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/.

ANDROID_AVD_HOME

Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large disk images. The default location is $ANDROID_EMULATOR_HOME/avd/. You might want to specify a new location if the default location is low on disk space.

I was looking for the same answer, but soon found out that most people programming for android do not know basic why and how and just follow the instruction given to them by a manager, blog, or manual until they manage to make an APK. at least it is true in my organization

ANDROID_SDK_HOME

Your Enviroment Variable ANDROID_SDK_HOME is set, but seemingly points to a wrong directory. You will have to update ANDROID_SDK_HOME to point to the new directory.

Setting the variable is described on similar questions, e.g. https://stackoverflow.com/a/23043099/1666181

Set ANDROID_HOME environment variable in mac

Open the terminal and type :

export ANDROID_HOME=/Applications/ADT/sdk

Add this to the PATH environment variable

export PATH=$PATH:$ANDROID_HOME/platform-tools

If the terminal doesn't locate the added path(s) from the .zshrc, please run this command

source ~/.zshrc

Hope it works to you!

ANDROID_SDK_HOME , a system variable or user variable?

Whether it should be a system or user variable depends on a few specific factors. A system variable applies to all user (and service) accounts on your computer, while a user variable applies to only your Windows user account.
If your Windows user account is the only one used for Android development, then a user variable is appropriate.

The value of this variable should point to the location where you extracted the Android SDK on your computer. If you used the installer and not the ZIP file, the environment variable should already be set.

Image showing the path in an example setup, and the folders that would be expected within the Android SDK

How to move ANDROID_SDK_HOME

The ANDROID_SDK_HOME referred is just an environment variable that points to the sdk home directory. So the solution wants you to move that directory and update the environment variable.



Related Topics



Leave a reply



Submit