Cannot find compatible version of Android SDK


#1

Trying to install nativescript on the my MAC. Below is the output of my “tns doctor” command. The IOS check passes but the Android one fails. I was able to install the sdk manager successfully using “brew cask install android-sdk” and I put the following in my .bash_profile file:

export ANDROID_HOME=/usr/local/Caskroom/android-sdk/25.2.3
export ANDROID_SDK_ROOT=/usr/local/Caskroom/android-sdk/25.2.3
export PATH=$M2:$PATH:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools/lib/x86_64

After the output of the tns doctor command is the output for my sdkmanager --list command. Every seems to be fine - not sure what the issue is - any help will be appreciated.

Tim McClure

Verifying CocoaPods. This may take more than a minute, please be patient.
nativescript-check-cocoapods@0.0.1 /private/var/folders/gf/h1js9h4159g03x0g150dlldc0000gn/T/nativescript-check-cocoapods117319-4015-tg32en.iqe1rwwmi
└── tns-ios@2.5.0

npm WARN nativescript-check-cocoapods@0.0.1 No description
npm WARN nativescript-check-cocoapods@0.0.1 No repository field.
npm WARN nativescript-check-cocoapods@0.0.1 No license field.

◜ Verifying CocoaPods. This may take some time, please be patient…
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ $ANDROID_HOME/tools/bin/sdkmanager 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_HOME/tools/bin/sdkmanager to manage the Android Support Repository.

There seem to be issues with your configuration.
? Do you want to visit the official documentation? (Y/n)

Output from sdkmanager:
Tims-MacBook-Pro:~ timmcclure$ sdkmanager --list
Warning: File /Users/timmcclure/.android/repositories.cfg could not be loaded.
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.0 Android Emulator emulator/
patcher;v4 1 SDK Patch Applier v4 patcher/v4/
platform-tools 25.0.4 Android SDK Platform-Tools platform-tools/
tools 26.0.1 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
cmake;3.6.3155560 3.6.3155560 CMake 3.6.3155560
docs 1 Documentation for Android SDK
emulator 26.0.0 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 39 Google Play services
extras;google;m2repository 46 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.4 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…;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.1 Android SDK Tools

done


#2

So I ran into this tonight after rebuilding a new laptop - so it appears it is happening on fresh installs (didn’t try a fresh install of 3.0 yet to see if it still exists)…what a pain :slight_smile:

Anyways it looks like there is an issue with NS looking for an older version so I created a cask script that seems to work to get the older version of Android installed and then you can use the old GUI to update the Android files.

From the command line run the following:

brew tap cask
brew tap nickbranstein/nativescript
brew cask install nativescript-android-sdk

Now you can run the following command to make the GUI pop up so you can do updates:

/usr/local/Caskroom/nativescript-android-sdk/22.0.1/tools/android update sdk

OR You should also be able to navigate to the path and run the command from the Andvanced installation on NativeScript.org (I had to run this 3 times to get everything that was needed to be installed):

/usr/local/Caskroom/nativescript-android-sdk/22.0.1/tools/android update sdk --filter tools,platform-tools,android-25,build-tools-25.0.2,extra-android-m2repository,extra-google-m2repository,extra-android-support --all --no-ui

Don’t forget to update you path for ANDROID_HOME to the new path now:

/usr/local/Caskroom/nativescript-android-sdk/22.0.1


#3

Following the above comment and reading the output from the sdkmanage command I realized the format changed a bit. I managed to tweak it a bit to get some things installed as follows:

Warning: Failed to find package tools,platform-tools,android-25,build-tools-25.0.2,extra-android-m2repository,extra-google-m2repository,extra-android-support
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "tools;platform-tools;android-25;build-tools-25.0.2;extra-android-m2repository;extra-google-m2repository;extra-android-support"
Warning: Failed to find package tools;platform-tools;android-25;build-tools-25.0.2;extra-android-m2repository;extra-google-m2repository;extra-android-support
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "tools"
done
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "platform-tools"
done
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "android-25"
Warning: Failed to find package android-25
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "platform;android-25"
Warning: Failed to find package platform;android-25
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-25"
done
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "extras;android-m2repository"
Warning: Failed to find package extras;android-m2repository
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "extras;android;m2repository"
done
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ $ANDROID_HOME/tools/bin/sdkmanager "extras;google;m2repository"
done

You can see the trial and error I went through to get all the items in the list Nick listed. After two hours banging my head against this I finally got to the happy result:

jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ tns doctor
Verifying CocoaPods. This may take more than a minute, please be patient.
nativescript-check-cocoapods@0.0.1 /private/var/folders/m7/gh75jm9d0wb6d1qvzltz40_00000gs/T/nativescript-check-cocoapods117415-33416-8d0vn0.2iitx4j9k9
└── tns-ios@3.0.0 

npm WARN nativescript-check-cocoapods@0.0.1 No description
npm WARN nativescript-check-cocoapods@0.0.1 No repository field.
npm WARN nativescript-check-cocoapods@0.0.1 No license field.

  ◠ Verifying CocoaPods. This may take some time, please be patient..
Your components are up-to-date.

No issues were detected.
jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns$ 

#4

jdchmiel - Thank you. Adding the libraries and extras one by one worked for me too. For whatever reason, following the nativescript docs format did not.

i.e. Tried the following first, but it resulted in the same missing Android SDK 22 error as the original post:

android update sdk --filter tools,platform-tools,android-25,build-tools-25.0.2,extra-android-m2repository,extra-google-m2repository,extra-android-support --all --no-ui


#5

It likely failed because users who installed the android SDK after some changes were made to the android dev tooling after the beginning of March through choco have a different user interface than those who previously had it installed.

The executable is entirely different, and the arguments also differ in how they should be passed to the commands. We’ll see to it that the article is updated properly.


#6

So that describes me as I just installed everything for the first time. I do see the android command being replaced with the sdkmanager - are there other changes? I got tns doctor to be happy, but I cannot get the hello world app to run on an android x86 VM or emulator - it seems to die out:

jchmielecki@RAL-JCHMIELECKI-2:~/Documents/tns/HelloWorld$ tns run android --device 1
Copying template files...
  ◜ Installing tns-androidInstalling  tns-android
/Users/jchmielecki/Documents/tns/HelloWorld
└── tns-android@3.0.0 


The plugin tns-android@3.0.0 is already installed
TypeError: Path must be a string. Received undefined
# run android

with some sort of path error, but I do not know anything about nativescript or even mobile dev so am at a bit of a loss as to how to debug this new to me toolset!

–log trace gives me more detail:


 stderr: 
Installing  tns-android
spawn: npm "install" "tns-android@3.0.0" "--silent" "--save-exact" "--save"
/Users/jchmielecki/Documents/tns/HelloWorld
└── tns-android@3.0.0 


The plugin tns-android@3.0.0 is already installed
TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at NpmInstallationManager.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:101:47)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:109:7)
Error: TypeError: Path must be a string. Received undefined
    at NpmInstallationManager.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:54:23)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/nativescript/lib/npm-installation-manager.js:5:65)
    at process._tickCallback (internal/process/next_tick.js:109:7)

at least I know where to start chasing?


#7

Remove the tns-android from your packages.json and try to tns platform add android again (or tns run). If it previously failed and never actually added the files it will still update the packages.json and throw this error.


#8

Thanks Nick, your comment sounded promising, but no change when I deleted the tns-android folder from node_modules. I even deleted the full node_modules folder and saw it recreate them all. THEN I re-read your comment better and saw you said remove it from package.json - so I dleted node_modules again, and then deleted the line from packages.json and it worked perfect on my x86 android port VM of 4.4 that I set up years ago when I thought I had to do something mobile. I did not expect the VM to work, but now everything works, awesome! Thanks a bunch!