How To Set Android SDK Path In Windows And Mac

After you installed android studio, you still need to configure some android SDK environment variables then you can use it easily. This article will tell you how to correctly configure SDK environment variable such as ANDROID_HOME, PATH etc.

1. Configure Android SDK Variable In Windows.

1.1 Get Android SDK Install Directory Path.

Before you can configure it, you should first get the android sdk install directory follow below steps.

  1. Open android studio, click File —> Settings menu item in the top men bar.
    android studio file settings
  2. Expand Appearance & Behavior —>  System Settings —> Android SDK menu item in left panel of the popup window. Then you can find the Android SDK Location directory path in right panel, remember it.
    tools android sdk platforms show package details

1.2 Set %ANDROID_HOME% and %Path% System Environment Variable.

  1. Right click the computer icon in windows file explorer left panel, click Properties menu item in the popup menu list. This will open the windows system configuration window.
    right click computer properties popup menu item
  2. Click Advanced system settings in left panel, it will popup System Properties window, click Environment Variables button to open Environment Variables window.
    set JAVA_HOME in windows system environment properties
  3. Click New… button to add a new system variable, input ANDROID_HOME as variable name and the android sdk location directory path ( such as C:\Users\Administrator\AppData\Local\Android\Sdk ) as variable value.
    add android home system environment variable
  4. Select variable Path and click Edit button and add ;%ANDROID_HOME%\tools;%ANDROID_HOME%\tools\bin;%ANDROID_HOME%\platform-tools at the end of it’s value. Please note the ; must be English character otherwise it will not take effect.
    add android sdk bin in path system environment variable correctly
  5. Click OK and close the system environment variables settings window, open a dos window, type command adb in it. If you see output like below that means the android sdk path variable has been configured successfully.
    C:\Users\Administrator>adb
    Android Debug Bridge version 1.0.39
    Version 0.0.1-4500957
    Installed as C:\Users\Administrator\AppData\Local\Android\Sdk\platform-tools\adb
    .exe

2. Configure Android SDK Variable In MacOS.

  1. Similar with windows, get the android sdk installation directory path in android studio. Generally the android sdk is installed in /Users/user-name/Library/Android/sdk folder in Mac OS.
  2. Use nano to create or edit user bash profile in user home directory.
    $ nano .bash_profile.
  3. Add ANDROID_HOME and PATH environment variable in user bash profile.
    export ANDROID_HOME=/Users/Jerry/Library/Android/sdk 
    export PATH=$PATH:$ANDROID_HOME/tools 
    export PATH=$PATH:$ANDROID_HOME/tools/bin
    export PATH=$PATH/:$ANDROID_HOME/platform-tools
  4. Make the added system environment take effect.
    $ source .bash_profile
  5. Now open a terminal and run adb, you should also see something output like in windows.
READ :   Android OkHttp3 Http Get Post Request Example

6 Comments


  1. This page is so helpful. After 48 years, I just solved the error 🙂

    Reply

  2. Configure Android SDK Variable In MacOS.

    Added path configuration, now ‘adb’ is up & running.
    Great job in sharing it.

    Reply

  3. Thanks for sharing commands to add Android Studio to mac os x path environment variables; at least ‘adb’ is up and running.

    Reply

  4. in the terminal window do this.

    1. Open command prompt

    2.
    > echo export “ANDROID_SDK=/Users//Library/Android/sdk” >> ~/.bash_profile

    Thats’s it.

    3.
    Close your terminal.

    4.
    Open it again.

    5. Type – echo $ANDROID_HOME to check if the home is set.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.