Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Xsmael opened this issue Mar 19, 2017 · 19 comments

Comments

@Xsmael
Copy link

Xsmael commented Mar 19, 2017

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!

@petekanev
Copy link
Contributor

Hey @Xsmael

Please have a look at the discussion in NativeScript/nativescript-cli#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

@fabiennb
Copy link

fabiennb commented Apr 4, 2017

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 !

@rashnk
Copy link

rashnk commented May 19, 2017

I have installed the latest , but same issue , how to fix

tns info
All NativeScript components versions information

┌──────────────────┬───────────────────────┬────────────────┬──────────────────┐
│ Component        │ Current version       │ Latest version │ Information      │
│ nativescript     │ 3.0.1-2017-05-18-8934 │ 3.0.1          │ Update available │
│ tns-core-modules │                       │ 3.0.0          │ Not installed    │
│ tns-android      │                       │ 3.0.0          │ Not installed    │
│ tns-ios          │                       │ 3.0.1          │ Not installed    │
└─────────────

@petekanev
Copy link
Contributor

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

@elujoba
Copy link

elujoba commented May 25, 2017

Hi. I'm having this same issue although I'm using a Mac. It keeps saying:

"You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system." everytime I try to add android as a platform. I've got SDK 22 to 25 installed. Is there something I'm missing?

@petekanev
Copy link
Contributor

@elujoba please refer to the comment above yours and verify that the paths resolve to existing directories and files on your machine.

@elujoba
Copy link

elujoba commented May 25, 2017

@Pip3r4o Thank you. I have just checked the three folders you specified. Also, I've checked to make sure my android variable is pointing to the right place and that SDK 22 is installed.

Doing sdkmanager --list gives me this (from $ANDROID_HOME):

Yinkas-MacBook-Air:yinka yinka$ sdkmanager --list
Installed packages:

Path Version Description Location
build-tools;25.0.2 25.0.2 Android SDK Build-Tools 25.0.2 build-tools/25.0.2/
emulator 26.0.3 Android Emulator emulator/
extras;intel;Ha...ecution_Manager 6.1.1 Intel x86 Emulator Accelerator... extras/intel/Ha...cution_Manager/
patcher;v4 1 SDK Patch Applier v4 patcher/v4/
platform-tools 25.0.6 Android SDK Platform-Tools platform-tools/
platforms;android-17 3 Android SDK Platform 17 platforms/android-17/
platforms;android-18 3 Android SDK Platform 18 platforms/android-18/
platforms;android-19 4 Android SDK Platform 19 platforms/android-19/
platforms;android-21 2 Android SDK Platform 21 platforms/android-21/
platforms;android-22 2 Android SDK Platform 22 platforms/android-22/
platforms;android-23 3 Android SDK Platform 23 platforms/android-23/
platforms;android-24 2 Android SDK Platform 24 platforms/android-24/
platforms;android-25 3 Android SDK Platform 25 platforms/android-25/
tools 26.0.2 Android SDK Tools tools/

Available Packages:

Path Version Description
add-ons;addon-g..._apis-google-15 3 Google APIs
add-ons;addon-g..._apis-google-16 4 Google APIs
add-ons;addon-g..._apis-google-17 4 Google APIs
add-ons;addon-g..._apis-google-18 4 Google APIs
add-ons;addon-g..._apis-google-19 20 Google APIs
add-ons;addon-g..._apis-google-21 1 Google APIs
add-ons;addon-g..._apis-google-22 1 Google APIs
add-ons;addon-g..._apis-google-23 1 Google APIs
add-ons;addon-g..._apis-google-24 1 Google APIs
add-ons;addon-g...e_gdk-google-19 11 Glass Development Kit Preview
build-tools;19.1.0 19.1.0 Android SDK Build-Tools 19.1
build-tools;20.0.0 20.0.0 Android SDK Build-Tools 20
build-tools;21.1.2 21.1.2 Android SDK Build-Tools 21.1.2
build-tools;22.0.1 22.0.1 Android SDK Build-Tools 22.0.1
build-tools;23.0.1 23.0.1 Android SDK Build-Tools 23.0.1
build-tools;23.0.2 23.0.2 Android SDK Build-Tools 23.0.2
build-tools;23.0.3 23.0.3 Android SDK Build-Tools 23.0.3
build-tools;24.0.0 24.0.0 Android SDK Build-Tools 24
build-tools;24.0.1 24.0.1 Android SDK Build-Tools 24.0.1
build-tools;24.0.2 24.0.2 Android SDK Build-Tools 24.0.2
build-tools;24.0.3 24.0.3 Android SDK Build-Tools 24.0.3
build-tools;25.0.0 25.0.0 Android SDK Build-Tools 25
build-tools;25.0.1 25.0.1 Android SDK Build-Tools 25.0.1
build-tools;25.0.2 25.0.2 Android SDK Build-Tools 25.0.2
build-tools;25.0.3 25.0.3 Android SDK Build-Tools 25.0.3
cmake;3.6.3155560 3.6.3155560 CMake 3.6.3155560
docs 1 Documentation for Android SDK
emulator 26.0.3 Android Emulator
extras;android;gapid;1 1.0.3 GPU Debugging tools
extras;android;gapid;3 3.1.0 GPU Debugging tools
extras;android;m2repository 47.0.0 Android Support Repository
extras;google;auto 1.1 Android Auto Desktop Head Unit...
extras;google;g...e_play_services 40 Google Play services
extras;google;instantapps 1.0.0 Instant Apps Development SDK
extras;google;m2repository 51 Google Repository
extras;google;m...t_apk_expansion 1 Google Play APK Expansion library
extras;google;market_licensing 1 Google Play Licensing Library
extras;google;play_billing 5 Google Play Billing Library
extras;google;simulators 1 Android Auto API Simulators
extras;google;webdriver 2 Google Web Driver
extras;intel;Ha...ecution_Manager 6.1.1 Intel x86 Emulator Accelerator...
extras;m2reposi...ut-solver;1.0.0 1 Solver for ConstraintLayout 1.0.0
extras;m2reposi...er;1.0.0-alpha2 1 com.android.support.constraint...
extras;m2reposi...er;1.0.0-alpha3 1 com.android.support.constraint...
extras;m2reposi...er;1.0.0-alpha4 1 com.android.support.constraint...
extras;m2reposi...er;1.0.0-alpha5 1 Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha6 1 Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha7 1 Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha8 1 Solver for ConstraintLayout 1....
extras;m2reposi...er;1.0.0-alpha9 1 Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta1 1 Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta2 1 Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta3 1 Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta4 1 Solver for ConstraintLayout 1....
extras;m2reposi...ver;1.0.0-beta5 1 Solver for ConstraintLayout 1....
extras;m2reposi...ut-solver;1.0.1 1 Solver for ConstraintLayout 1.0.1
extras;m2reposi...ut-solver;1.0.2 1 Solver for ConstraintLayout 1.0.2
extras;m2reposi...nt-layout;1.0.0 1 ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha2 1 com.android.support.constraint...
extras;m2reposi...ut;1.0.0-alpha3 1 com.android.support.constraint...
extras;m2reposi...ut;1.0.0-alpha4 1 com.android.support.constraint...
extras;m2reposi...ut;1.0.0-alpha5 1 ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha6 1 ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha7 1 ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha8 1 ConstraintLayout for Android 1...
extras;m2reposi...ut;1.0.0-alpha9 1 ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta1 1 ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta2 1 ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta3 1 ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta4 1 ConstraintLayout for Android 1...
extras;m2reposi...out;1.0.0-beta5 1 ConstraintLayout for Android 1...
extras;m2reposi...nt-layout;1.0.1 1 ConstraintLayout for Android 1...
extras;m2reposi...nt-layout;1.0.2 1 ConstraintLayout for Android 1...
lldb;2.0 2.0.2558144 LLDB 2.0
lldb;2.1 2.1.2852477 LLDB 2.1
lldb;2.2 2.2.3271982 LLDB 2.2
lldb;2.3 2.3.3614996 LLDB 2.3
ndk-bundle 14.1.3816874 NDK
patcher;v4 1 SDK Patch Applier v4
platform-tools 25.0.6 Android SDK Platform-Tools
platforms;android-10 2 Android SDK Platform 10
platforms;android-11 2 Android SDK Platform 11
platforms;android-12 3 Android SDK Platform 12
platforms;android-13 1 Android SDK Platform 13
platforms;android-14 4 Android SDK Platform 14
platforms;android-15 5 Android SDK Platform 15
platforms;android-16 5 Android SDK Platform 16
platforms;android-17 3 Android SDK Platform 17
platforms;android-18 3 Android SDK Platform 18
platforms;android-19 4 Android SDK Platform 19
platforms;android-20 2 Android SDK Platform 20
platforms;android-21 2 Android SDK Platform 21
platforms;android-22 2 Android SDK Platform 22
platforms;android-23 3 Android SDK Platform 23
platforms;android-24 2 Android SDK Platform 24
platforms;android-25 3 Android SDK Platform 25
platforms;android-7 3 Android SDK Platform 7
platforms;android-8 3 Android SDK Platform 8
platforms;android-9 2 Android SDK Platform 9
sources;android-15 2 Sources for Android 15
sources;android-16 2 Sources for Android 16
sources;android-17 1 Sources for Android 17
sources;android-18 1 Sources for Android 18
sources;android-19 2 Sources for Android 19
sources;android-20 1 Sources for Android 20
sources;android-21 1 Sources for Android 21
sources;android-22 1 Sources for Android 22
sources;android-23 1 Sources for Android 23
sources;android-24 1 Sources for Android 24
sources;android-25 1 Sources for Android 25
system-images;a...ult;armeabi-v7a 4 ARM EABI v7a System Image
system-images;a...-10;default;x86 4 Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a 5 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 5 Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a 2 ARM EABI v7a System Image
system-images;a...ult;armeabi-v7a 4 ARM EABI v7a System Image
system-images;a...15;default;mips 1 MIPS System Image
system-images;a...-15;default;x86 4 Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a 5 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 5 Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a 4 ARM EABI v7a System Image
system-images;a...16;default;mips 1 MIPS System Image
system-images;a...-16;default;x86 5 Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a 5 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 5 Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a 5 ARM EABI v7a System Image
system-images;a...17;default;mips 1 MIPS System Image
system-images;a...-17;default;x86 3 Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a 5 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 5 Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a 4 ARM EABI v7a System Image
system-images;a...-18;default;x86 3 Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a 5 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 5 Google APIs Intel x86 Atom Sys...
system-images;a...ult;armeabi-v7a 5 ARM EABI v7a System Image
system-images;a...-19;default;x86 5 Intel x86 Atom System Image
system-images;a...pis;armeabi-v7a 27 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 27 Google APIs Intel x86 Atom Sys...
system-images;a...-tv;armeabi-v7a 3 Android TV ARM EABI v7a System...
system-images;a...;android-tv;x86 3 Android TV Intel x86 Atom Syst...
system-images;a...ult;armeabi-v7a 4 ARM EABI v7a System Image
system-images;a...-21;default;x86 4 Intel x86 Atom System Image
system-images;a...;default;x86_64 4 Intel x86 Atom_64 System Image
system-images;a...pis;armeabi-v7a 19 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 19 Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 19 Google APIs Intel x86 Atom_64 ...
system-images;a...-tv;armeabi-v7a 1 Android TV ARM EABI v7a System...
system-images;a...;android-tv;x86 3 Android TV Intel x86 Atom Syst...
system-images;a...ult;armeabi-v7a 2 ARM EABI v7a System Image
system-images;a...-22;default;x86 5 Intel x86 Atom System Image
system-images;a...;default;x86_64 5 Intel x86 Atom_64 System Image
system-images;a...pis;armeabi-v7a 13 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 13 Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 13 Google APIs Intel x86 Atom_64 ...
system-images;a...-tv;armeabi-v7a 3 Android TV ARM EABI v7a System...
system-images;a...;android-tv;x86 9 Android TV Intel x86 Atom Syst...
system-images;a...ear;armeabi-v7a 6 Android Wear ARM EABI v7a Syst...
system-images;a...ndroid-wear;x86 6 Android Wear Intel x86 Atom Sy...
system-images;a...-23;default;x86 9 Intel x86 Atom System Image
system-images;a...;default;x86_64 9 Intel x86 Atom_64 System Image
system-images;a...pis;armeabi-v7a 20 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 20 Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 20 Google APIs Intel x86 Atom_64 ...
system-images;a...;android-tv;x86 10 Android TV Intel x86 Atom Syst...
system-images;a...fault;arm64-v8a 7 ARM 64 v8a System Image
system-images;a...ult;armeabi-v7a 7 ARM EABI v7a System Image
system-images;a...-24;default;x86 7 Intel x86 Atom System Image
system-images;a...;default;x86_64 7 Intel x86 Atom_64 System Image
system-images;a..._apis;arm64-v8a 11 Google APIs ARM 64 v8a System ...
system-images;a...pis;armeabi-v7a 11 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 11 Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 11 Google APIs Intel x86 Atom_64 ...
system-images;a...s_playstore;x86 12 Google Play Intel x86 Atom Sys...
system-images;a...;android-tv;x86 3 Android TV Intel x86 Atom Syst...
system-images;a...ear;armeabi-v7a 3 Android Wear ARM EABI v7a Syst...
system-images;a...ndroid-wear;x86 3 Android Wear Intel x86 Atom Sy...
system-images;a..._apis;arm64-v8a 4 Google APIs ARM 64 v8a System ...
system-images;a...pis;armeabi-v7a 4 Google APIs ARM EABI v7a Syste...
system-images;a...google_apis;x86 4 Google APIs Intel x86 Atom Sys...
system-images;a...gle_apis;x86_64 4 Google APIs Intel x86 Atom_64 ...
tools 26.0.2 Android SDK Tools

@elujoba
Copy link

elujoba commented May 25, 2017

@Pip3r4o Apparently, because I had android studio installed. I had two different folders for the SDK. The original one and the one installed by Homebrew. I've redirected now and tns doctor is no longer complaining. However, I can't seem to be able to deploy to my android phone. tns run android is not working. Even after adding the --device flag with the Device ID. Is there something I'm missing? I've looked all over but I can't find any way to deploy to an actual device. I'm sorry if this is out of scope of the original issue, but I'd like to move to actual coding asap and get past setting up. Thanks!

@dang1412
Copy link

dang1412 commented Jun 3, 2017

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

@neilbhasme
Copy link

suggestion of @dttung-mario (owe a 'Thank you!') was a good one. To add to it, although I had installed the Android Support Repository, it was pending update that was creating this issue. When I updated it, all was fine.

@zhaoshiming
Copy link

i got this problem too,and i fixed it , you can install android sdk 22, this is very important.

@filipbarak
Copy link

@dttung-mario Thanks. This solution helped me, it was exactly what was missing :)

@A1Gard
Copy link

A1Gard commented Apr 1, 2018

@elujoba Oh man I try to fix this error, But your answer only write Thanks man. +1

@romanesko
Copy link

Have the same issue.

sdkmanager --list

  Path                                                | Version | Description                                     | Location
  -------                                             | ------- | -------                                         | -------
  build-tools;27.0.3                                  | 27.0.3  | Android SDK Build-Tools 27.0.3                  | build-tools/27.0.3/
  emulator                                            | 27.2.9  | Android Emulator                                | emulator/
  extras;android;m2repository                         | 47.0.0  | Android Support Repository                      | extras/android/m2repository/
  extras;google;m2repository                          | 58      | Google Repository                               | extras/google/m2repository/
  extras;intel;Hardware_Accelerated_Execution_Manager | 7.2.0   | Intel x86 Emulator Accelerator (HAXM installer) | extras/intel/Hardware_Accelerated_Execution_Manager/
  patcher;v4                                          | 1       | SDK Patch Applier v4                            | patcher/v4/
  platform-tools                                      | 28.0.0  | Android SDK Platform-Tools                      | platform-tools/
  platforms;android-25                                | 3       | Android SDK Platform 25                         | platforms/android-25/
  tools                                               | 26.1.1  | Android SDK Tools 26.1.1                        | tools/

$ANDROID_HOME/platforms, $ANDROID_HOME/tools and $ANDROID_HOME/extras are valid paths

but still tns doctor says

✖ You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.

@Marcidius
Copy link

Marcidius commented Aug 1, 2018

@dang1412 Your solution was it! At least partially it!

I went into SDK Manager through Android Studio, clicked to SDK Tools and clicked to CHECK (they were previously unchecked) Android Support Repository, NDK, and Instant Apps Development SDK.

Before I did this, tns doctor was complaining but after I did that install and restarted my terminal, viola, it worked! tns doctor comes back with No issues were detected.

I have been working on this for days. Now to see if my emulator will actually launch... either way though, this is a huge step forward. Thanks!

UPDATE: 8/1/18
The emulator did NOT launch successfully. I decided to uninstall the Brew's installation of the SDK just to make sure there were not different references out there (the Brew install and the Android Studio install). When I did that, tns doctor hiccuped again.

After screwing around some more and making sure my .bash_profile had the proper path to ANDROID_HOME... in this case export ANDROID_HOME=/Users/myusername/Library/Android/sdk.

After that sdkmanager wasn't working still. So, I went in and modified my paths /etc/paths and added a reference to /Users/myusername/Library/Android/sdk/tools/bin and then sdkmanager started working again from the command line. .../tools and .../platform-tools still have entries in the path as well.

Based on what I've read so far, my setup should be fine... but tns doctor keeps spitting back errors.

UPDATE: 8/1/18 #2:
2 Steps that I did to fix this!

  1. I realized the SDK I had installed through the SDK Manager was v 28 which does not meet the criteria for the verison of Nativescript I'm using (4.1.2). The SDK needs to be between 22 and 27. I uninstalled 28 and installed 27.0.3. Running tns doctor got me all green checks but the emulator still wouldn't launch!

  2. I decided to follow the Android Studio setup of a device (https://developer.android.com/studio/run/managing-avds.html) instead of through terminal. I was hesitant before because I didn't feel like going through the project creation just to do that... but I was at an impásse. So, once I created a new device through Tools/AVD Manager and targeted it specifically within my project folder: tns run android --device deviceIDnumber where deviceIDnumber is the ID of your device. This worked and launched the emulator successfully!

@mimamo10
Copy link

Exactly same problem and 2 step solution as Marcidius above.

@divyachandana
Copy link

updating SDK in AndroidStudio >> Preferences would help

screen shot 2018-10-16 at 3 25 26 am

@nikoTM
Copy link

nikoTM commented Dec 3, 2018

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.

@lock
Copy link

lock bot commented Dec 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests