Android SDK is not found although ANDROID_HOME is set successfully (android Studio on MacOS)


I’ve freshly installed AndroidStudio on MacOS Big Sur 11.6.2 to create a NativeScript project.

Installation went smoothly. However, when I run ns doctor android, it complains that Android SDK is not set: "✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later."

But ANDROID_HOME is successfully set! I use zsh, so the configuration is located in .zshrc, here it is:

if [ -f /Users/testuser/.tnsrc ]; then 
    source /Users/testuser/.tnsrc
    export ANDROID_HOME=/Users/testuser/Library/Android/sdk
    export PATH=$PATH:$ANDROID_HOME/platform-tools


If I type echo $ANDROID_HOME, output is correct: /Users/testuser/Library/Android/sdk. For safety, I also checked if it would work when using .bashrc and .bash_profile, no success.

Furthermore, if I check Preferences in AndroidStudio –> AndroidSDK –> SDK Platforms, it shows Android API 32 together with the correct path shown above.

Additionally installed:

  • Android SDK Build Tools – 32
  • NDK (side by side)
  • Android SDK Command-line tools
  • Android Emulator
  • Android SDK Platform Tools
  • … as well as all SDK Update sites.

In Project Structure, the correct Android SDK location is listed (/Users/testuser/Library/Android/sdk).

I checked if /Users/testuser/Library/Android/sdk really exists, and it does. Everything is there.

This solution didn’t work. Invalidate caches and restart as suggested here doesn’t work also. with the SDK path as shown here is already preset by AndroidStudio, pointing to: sdk.dir=/Users/testuser/Library/Android/sdk.

I’m desperate and don’t know what to do anymore. Who can help me? Any idea is appreciated!


This may be related to the standard "Android SDK Tools" being marked as "Obsolete" in Android Studio.

  • Depending on your AS version, either uncheck "Hide Obsolete Packages" or check "Obsolete" so obsolete options are displayed.
  • Select and install "Android SDK Tools (Obsolete)".
  • Once that completed, add the following lines to your .zshrc profile with the rest of the exports:
export PATH=$PATH:$ANDROID_HOME/tools/bin

Answered By – Viridian Kailin

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published