NativeScript: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later

I get this error when i run tns doctor i googled, stackoverflowed and everything you can imagine, setting environment variables installing SDKs and tools, but still nothing works, so i ended up here, plz help!

Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ android to manage your Android SDK versions.

You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ android  to manage the Android Support Repository.

My config: Windows 10 64bit Android studio 2.2.2 i installed SDK 22, 19, 24 and 25 NodeJS v6.9.5 npm: 3.10.10

Please HELP!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

As pointed out by @divyachandana it seems like the issue is not with SDK tools but SDK platform (android-28 in my case)

Running this command solved it for me:

$ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"

EDIT:

Still, needs a clear error message. From the message above it’s not clear what’s wrong.

@elujoba it seems that you also have to install Extras/Android Support Repository listed in Android SDK Manager

@rashnk it is likely an incorrect path to the ANDROID_HOME directory. Please double check that you can find %ANDROID_HOME%/platforms, %ANDROID_HOME%/tools, %ANDROID_HOME%/extras on your developer machine. It is possible that you have not installed the extras package of the Android SDK that has the android support repositories included.

For me the latest nativescript is not working. I had to specify version 2.5.3, like this: npm i -g nativescript@2.5.3

Thanks !

Hey @Xsmael

Please have a look at the discussion in https://github.com/NativeScript/nativescript-cli/issues/2583

You can either:

  • download an older version of the Android SDK Tools
  • install the latest nativescript from the master branch npm i nativescript@next -g
  • wait for the next release of nativescript@2.5.3 which is coming this week