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.
- Open android studio, click File —> Settings menu item in the top men bar.
- 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.
1.2 Set %ANDROID_HOME% and %Path% System Environment Variable.
- 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.
- Click Advanced system settings in left panel, it will popup System Properties window, click Environment Variables button to open Environment Variables window.
- 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.
- 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.
- 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.
- 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.
- Use nano to create or edit user bash profile in user home directory.
$ nano .bash_profile.
- 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
- Make the added system environment take effect.
$ source .bash_profile
- Now open a terminal and run adb, you should also see something output like in windows.