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 them easily. This article will tell you how to correctly configure Android SDK environment variables such as ANDROID_HOME, PATH on both Windows and macOS.

1. Configure Android SDK Variable In Windows.

1.1 Get Android SDK Install Directory Path.

  1. Before you can configure it, you should first get the android SDK install directory following the steps below.
  2. Open android studio, click File —> Settings menu item in the top menu bar.
  3. Expand Appearance & Behavior —>  System Settings —> Android SDK menu item on the left side of the popup window. Then you can find the Android SDK Location directory path on the right side ( in this example, the Android SDK location path is C:\Users\Jerry\AppData\Local\Android\Sdk ), 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 side, click Properties menu item in the popup menu list. This will open the windows system configuration window.
  2. Click the Advanced system settings link on the left panel, it will popup the System Properties window, click the Environment Variables button to open the Environment Variables window.
    set-JAVA_HOME-in-windows-system-environment-properties-1
  3. Click the New… button to add a new system variable, input ANDROID_HOME as the variable name, and input the Android SDK location directory path ( such as C:\Users\Administrator\AppData\Local\Android\Sdk ) as the 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 its 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 to 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. Open Android Studio on macOS, then click Android Studio —> Preferences menu item at the left top toolbar.
  2. Input search keyword sdk in the search box of the popup Preferences dialog window left side.
  3. It will focus on the Android SDK menu item on the left side, and you can get the Android SDK Location directory path value on the right side Android SDK Location text box.
  4. Generally, the Android SDK is installed in the /Users/user-name/Library/Android/sdk folder on macOS.
  5. If you can not find the above folder in macOS finder or terminal, this is because the Library folder is a hidden folder by default, you should make the hidden folder visible by executing the command $ defaults write com.apple.finder AppleShowAllFiles TRUE in a macOS terminal window ( please read article How To Show Hidden Files In Mac OS Finder And Select Hidden Files In Html Upload File Form ).
  6. You can also see the hidden Library folder by opening a macOS Finder window, then click Go —> Go to Folder… menu item, and input ~/Library in the popup dialog input text box, then click Go button.
  7. This is also another method to show the hidden Library folder, open a macOS Finder window, click Go —> Home menu item. Right-click the home folder, then click the Show View Options menu item in the popup menu list. Check the Show Library Folder checkbox.
  8. Use nano to create or edit user bash profile in user home directory.
    $ nano .bash_profile.
  9. 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
    
  10. Make the added system environment take effect.
    $ source .bash_profile
  11. Now open a terminal and run adb, you should also see something output like in windows.

3. How To Download And Install Android SDK Command Line Tool Manually.

  1. If you do not need Android Studio, and you just want to use android SDK command-line tools only, it is very easy also.
  2. Go to the android SDK command-line tools download page and download the related zip files.
  3. Unzip the zip file to a local folder for example C:\android-sdk.
  4. Now when you start the Android Studio for the next time, it will let you select the android SDK location folder, just select the above folder.
  5. You can also change the android SDK location folder in the Android Studio Settings dialog.
  6. For Windows, start Android Studio, then click File —> Settings menu item.
  7. For macOS, start Android Studio, then click Android Studio —> Preferences menu item.
  8. Select Appearance & Behavior —> System Settings —> Android SDK menu item in the popup window left side.
  9. On the window right side, click the Edit link after the Android SDK Location text box, it will open the SDK Setup dialog.
  10. At the bottom of the SDK Setup dialog, there is an Android SDK Location text box, you can browse the new Android SDK folder to use it.

7 thoughts on “How To Set Android SDK Path In Windows And Mac”

  1. HAFIZ MUHAMMAD AWAIS RAZA

    mera masla ni solve ho raha sdk path e set ni ho raha macbook mai kindly koi help kr day

  2. 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.

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

  4. Configure Android SDK Variable In MacOS.

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

Leave a Comment

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.