How do I set ANDROID_SDK_HOME environment variable?

303,232

Solution 1

ANDROID_HOME

Installation directory of Android SDK package.

Example: C:\AndroidSDK or /usr/local/android-sdk/

ANDROID_USER_HOME

Location of SDK related data/user files.

Example: C:\Users\<USERNAME>\.android\ or ~/.android/

ANDROID_SDK_ROOT

Deprecated (in Android Studio), use ANDROID_HOME instead.

ANDROID_NDK_ROOT

Installation directory of Android NDK package. (WITHOUT ANY SPACE)

Example: C:\AndroidNDK or /usr/local/android-ndk/

ANDROID_SDK_HOME

Deprecated (in Android Studio 4.2), use ANDROID_PREFS_ROOT instead.

ANDROID_PREFS_ROOT

Deprecated (in Android Studio), use path to subdirectory .android via ANDROID_USER_HOME instead.

Example: C:\Users\<USERNAME>\ or ~/

ANDROID_EMULATOR_HOME

Location of emulator-specific data files.

Example: C:\Users\<USERNAME>\.android\ or ~/.android/

ANDROID_AVD_HOME

Location of AVD-specific data files.

Example: C:\Users\<USERNAME>\.android\avd\ or ~/.android/avd/

JDK_HOME and JAVA_HOME

Installation directory of JDK (aka Java SDK) package.

Note: This is used to run Android Studio(and other Java-based applications). Actually when you run Android Studio, it checks for JDK_HOME then JAVA_HOME environment variables to use.

Solution 2

If you face the same error, here are the step by step instructions:

  1. Open control panel
  2. Then go to System
  3. Then go to Change Environment Variables of the User
  4. Then click create a new environment variables
  5. Create a new variable named ANDROID_SDK_HOME
  6. Set its value to your Android directory, like C:/users/<username>/.android

Solution 3

Copy your SDK path and assign it to the environment variable ANDROID_SDK_ROOT

Refer pic below:

enter image description here

Solution 4

This worked for me:

  1. Open control panel
  2. click System
  3. Then go to Change Environment Variables
  4. Then click create a new environment variables
  5. Create a new variable named ANDROID_HOME path C:\Android\sdk

Solution 5

open your adt and open preferences, then modify directory with your sdk dir, it may help you follow the pic link indication

enter image description here

Share:
303,232
OlegArsyonov
Author by

OlegArsyonov

MERN/LAMP/MEAN

Updated on January 17, 2022

Comments

  • OlegArsyonov
    OlegArsyonov over 2 years

    I'm working with Eclipse on Windows 7, x64. I'm getting an error when running ADT bundle of android development:

    Error: Error parsing the AVDs
    Unable to get the Android SDK home directory.
    Make sure the environment variable ANDROID_SDK_HOME is set up.

    I know what the issue is. Is it because it is linked to a wrong directory C:users:????

    How do I set this environment variable android_sdk_home to the proper directory?

  • OlegArsyonov
    OlegArsyonov about 10 years
    I need ANDROID_SDK_HOME variable to set. SDK dir is nice and set..... How do I SET ANDROID_SDK_HOME variable? What that variable is? Where is it?
  • jww
    jww over 9 years
    If this is the answer, then you should accept your own answer. That's how Stack Overflow works. See How does accepting an answer work?.
  • jww
    jww over 9 years
    This does not look quite right: C:/users/<username>/.android. That looks like the ANDROID_HOME directory, and not the SDK directory. The SDK directory would be ANDROID_SDK_ROOT. Here's the reference on ANDROID_SDK_ROOT and ANDROID_NDK_ROOT: Recommended NDK Directory?. The fellow named Digit works on the NDK team.
  • Camilo Martin
    Camilo Martin over 9 years
    Please upload images through this site's interface (they get hosted on imgur).
  • Frank
    Frank almost 8 years
    @jww - did you read the thread you linked? It never even references ANDROID_HOME. It only refers to 3 variables as 'standard.' In addition, it specifies ANDROID_SDK_HOME as equaling ~/.android/ on Linux, which corresponds to %USERPROFILE%\.android on Windows. The fact is that, you don't need to specify the .android subfolder. On Windows, you just set ANDROID_SDK_HOME to whatever folder it resides in. So, in the OP's case, it would be set to C:\Users\<username> or %UserProfile% and for others, wherever you like. The only caveat is that the (parent) folder must exist.
  • jww
    jww almost 8 years
    @Frank - yes, I read it (it was my question to the NDK folks). ANDROID_SDK_ROOT is the one variable I am aware of that Android uses to determine the SDK location. Who knows what ANDROID_SDK_HOME is. Eclipse does not document it, and its not obvious to me why yet another variable is needed. My best guess is you should set ANDROID_SDK_HOME to ANDROID_SDK_ROOT.
  • Kartiikeya
    Kartiikeya almost 8 years
    Whether the location should be in C drive ?
  • Yousha Aleayoub
    Yousha Aleayoub over 7 years
    @Kartiikeya, No, anywhere. But given path shouldnt contain space.
  • Snappy Cracker
    Snappy Cracker over 6 years
    ANDROID_HOME will work if the path is correct. If the path is incorrect or is unable to find ANDROID_HOME it will look for ANDROID_SDK_HOME. That is why it works if you have either set correctly.
  • Snappy Cracker
    Snappy Cracker over 6 years
    READ before commenting for the love of Martha. Several comments above tell you how to find the location of your particular SDK location. set ANDROID_SDK_HOME=C:[wherever your sdk folder is] and that is explained above, look just above at the large image.
  • Yousha Aleayoub
    Yousha Aleayoub over 6 years
    ANDROID_HOME is DEPRECATED, set ANDROID_SDK_ROOT instead.
  • Joshua Pinter
    Joshua Pinter about 6 years
    I had a difficult time getting Android Studio respecting these environment variables. I would set the ANDROID_SDK_HOME but Android Studio would still want to create AVDs in the ~/.android/avd directory. Any idea what could be the issue? I ended up using a symlink from ~/.android to my desired directory.
  • binary
    binary over 5 years
    @JoshuaPinter I had same issue, somehow Android Studio is not honoring any of these environment variables, at last symlink worked well.
  • Earlee
    Earlee about 5 years
    @YoushaAleayoub ANDROID_SDK_ROOT or ANDROID_SDK_HOME?
  • Zack
    Zack over 4 years
    Created a symbolic link using ln -s $ANDROID_SDK_HOME ~/.android
  • Vigs
    Vigs about 4 years
    Worked for me! Also great to read up here: developer.android.com/studio/command-line/…
  • Zoe Marmara
    Zoe Marmara about 4 years
    I was missing the 'JDK_HOME' system variable. Thanks! 🙏🙏🙏
  • George
    George almost 4 years
    OP should set this as selected answer.
  • 9 Guy
    9 Guy about 3 years
    On windows look in AppData\Local\Android\
  • 4b0
    4b0 almost 3 years
    Snehal wadbudhe, a link to a solution is welcome, but please ensure your answer is useful without it: add context around the link so your fellow users will have some idea what it is and why it is there, then quote the most relevant part of the page you are linking to in case the target page is unavailable. Answers that are little more than a link may be deleted.
  • Ola Ström
    Ola Ström over 2 years
    Another way to open the Advanced Properties is by using the Win+R keyboard shortcut and typing the command "sysdm.cpl ,3".
  • Ola Ström
    Ola Ström over 2 years
    But I guess you should use ANDROID_SDK_ROOT instead of ANDROID_HOME, see below answers.