Developer guide · Windows and Mac
How to set ANDROID_HOME on a Mac (zsh) and on Windows
By Aqib Javed · Updated Nov 27, 2026
On a Mac, add export ANDROID_HOME="$HOME/Library/Android/sdk" to ~/.zshrc, add its platform-tools, emulator and cmdline-tools/latest/bin folders to PATH, and open a new terminal. On Windows, create a user variable named ANDROID_HOME with the value %LOCALAPPDATA%\Android\Sdk and add its platform-tools folder to Path. Check with echo $ANDROID_HOME (echo %ANDROID_HOME% on Windows) and adb version. Set ANDROID_HOME, not ANDROID_SDK_ROOT, which Google marks deprecated.
Find your Android SDK path first
- Mac: ~/Library/Android/sdk, which is /Users/you/Library/Android/sdk.
- Windows: %LOCALAPPDATA%\Android\Sdk, which is C:\Users\you\AppData\Local\Android\Sdk.
- Linux: ~/Android/Sdk.
- If you moved it, Android Studio shows the real path under Settings > Languages & Frameworks > Android SDK (Android Studio > Settings on a Mac, File > Settings on Windows), next to Android SDK Location.
ANDROID_HOME points at the SDK folder itself, the one that holds platform-tools, platforms and build-tools, rather than at platform-tools or the Android Studio app. The guide to the Android SDK location covers finding a moved SDK and shrinking it.
How to set ANDROID_HOME on a Mac with zsh
- Open ~/.zshrc in a text editor: open -e ~/.zshrc, or nano ~/.zshrc. If it doesn't exist, run touch ~/.zshrc first.
- Add the lines below at the end and save. Use $HOME rather than ~ inside the quotes, because zsh doesn't expand ~ there.
- Run source ~/.zshrc, or open a new terminal window.
zsh has been the Mac's default shell since macOS Catalina. ~/.zprofile works as well (Google's example uses it); pick one file so the lines aren't set twice. If you still use bash, put the same lines in ~/.bash_profile.
platform-tools holds adb, emulator holds the emulator, and cmdline-tools/latest/bin holds sdkmanager and avdmanager. Google's environment variables page still lists tools and tools/bin, but those belong to the old SDK Tools package, which the Command-line Tools package replaced. Leave them out unless an old project needs them.
# ~/.zshrc
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH="$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$ANDROID_HOME/cmdline-tools/latest/bin"How to set ANDROID_HOME on Windows 10 and 11
- Open the Start menu, search for "environment variables" and choose Edit environment variables for your account. This needs no admin rights.
- Under User variables, click New. Set Variable name to ANDROID_HOME and Variable value to %LOCALAPPDATA%\Android\Sdk, or the folder Android Studio shows.
- Select Path, click Edit, and add three entries with New: %LOCALAPPDATA%\Android\Sdk\platform-tools, %LOCALAPPDATA%\Android\Sdk\emulator and %LOCALAPPDATA%\Android\Sdk\cmdline-tools\latest\bin.
- Click OK in every window, then open a new terminal and restart Android Studio or VS Code. Programs read environment variables when they start, so no reboot is needed.
Both commands set the user variable for windows you open afterwards; the window you type in keeps the old value. Use them for ANDROID_HOME, and edit Path in the dialog. setx crops values over 1,024 characters and turns %VARIABLES% into fixed folders, and Microsoft's documentation warns that this can lose data in an existing Path.
:: Command Prompt
setx ANDROID_HOME "%LOCALAPPDATA%\Android\Sdk"
# PowerShell
[Environment]::SetEnvironmentVariable('ANDROID_HOME', "$env:LOCALAPPDATA\Android\Sdk", 'User')Check that it works
echo should print the SDK folder, and adb version should print a version and the path it runs from. command not found (or "is not recognized" on Windows) means the folder isn't on PATH, the package isn't installed, or the terminal was open before the change. If only sdkmanager is missing, install Android SDK Command-line Tools (latest) in Android Studio's SDK Manager, under SDK Tools.
# Mac
echo $ANDROID_HOME
which adb
adb version
emulator -list-avds
sdkmanager --version
# Windows PowerShell
$env:ANDROID_HOME
where.exe adb
adb versionANDROID_SDK_ROOT is deprecated: use ANDROID_HOME
Google's Android environment variables reference says ANDROID_SDK_ROOT is deprecated and ANDROID_HOME sets the SDK path. If you still set ANDROID_SDK_ROOT, Android Studio and the Android Gradle Plugin check that both variables agree. When they point to different folders, Gradle stops with "Several environment variables and/or system properties contain different paths to the SDK." Remove ANDROID_SDK_ROOT, or make it the same folder.
# Mac: find old lines
grep -n ANDROID ~/.zshrc ~/.zprofile ~/.bash_profile 2>/dev/null
unset ANDROID_SDK_ROOT # this window; delete the line from the file too
# Windows PowerShell: delete the user variable (or delete it in the Environment Variables dialog)
[Environment]::SetEnvironmentVariable('ANDROID_SDK_ROOT', $null, 'User')local.properties and Flutter can override ANDROID_HOME
- Gradle reads sdk.dir from the project's local.properties first and uses ANDROID_HOME only when that line is missing. Android Studio writes the file for each project, so one project can build with a different SDK than the one ANDROID_HOME names. The file is meant for one machine and is in .gitignore by default.
- Flutter picks its SDK in this order: the folder set with flutter config --android-sdk, then ANDROID_HOME, then ANDROID_SDK_ROOT, then the default folder. On every Android build it writes that path into android/local.properties as sdk.dir.
- flutter doctor -v shows the SDK Flutter uses on its Android SDK at line.
flutter config --android-sdk "$HOME/Library/Android/sdk"
flutter doctor -v
# Windows
flutter config --android-sdk "%LOCALAPPDATA%\Android\Sdk"
# android/local.properties
sdk.dir=/Users/you/Library/Android/sdkWhere Stackyard helps
Stackyard is a free, open-source app for Mac and Windows. It finds every Android SDK on the machine and flags a second SDK folder along with the projects whose local.properties point to it, which is how a build ends up on a different SDK than ANDROID_HOME. On Windows its doctor also catches an ANDROID_HOME that points to a missing folder and fixes it, after showing you the change. On a Mac you set ANDROID_HOME with the lines above. Stackyard never edits your projects.
Questions
Should I put ANDROID_HOME in .zshrc or .zprofile on a Mac?
- Either works in Terminal. ~/.zshrc is read by every interactive zsh, ~/.zprofile by login shells, which is what Terminal opens. Use one file, not both.
Is ANDROID_SDK_ROOT deprecated?
- Yes. Google's documentation says to use ANDROID_HOME. If both are set they must name the same folder, or Gradle stops with an error about different SDK paths.
What should ANDROID_HOME point to?
- The SDK root folder, the one that contains platform-tools, platforms and build-tools. Pointing it at platform-tools or at the Android Studio app is a common mistake.
Do I need ANDROID_HOME for Flutter?
- Not if the SDK is in the default folder, because Flutter finds it there. If it's elsewhere, run flutter config --android-sdk with the path, or set ANDROID_HOME.
Why does adb say command not found after setting ANDROID_HOME?
- ANDROID_HOME alone doesn't put adb on PATH. Add $ANDROID_HOME/platform-tools to PATH (the platform-tools folder on Windows), check that the folder exists, and open a new terminal.