11

I have installed Android Studio and further installed the SDKs and tools via Android Studio. Here they are:

enter image description here enter image description here

And my $ANDROID_HOME paths to the following: /Users/USER/Library/Android/sdk both in the terminal as well as in Android Studio.

However, when running tns doctor I get the following:

(...) Verifying CocoaPods. This may take some time, please be patient ◟ Verifying CocoaPods. This may take some time, please be patient ◜ Verifying CocoaPods. This may take some time, please be patient ◠ Verifying CocoaPods. This may take some time, please be patient ◝ Verifying CocoaPods. This may take some time, please be patient ◞ Verifying CocoaPods. This may take some time, please be patient ◡ Verifying CocoaPods. This may take some time, please be patient..

You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=25'. Run $ $ANDROID_HOME/tools/bin/sdkmanager from your command-line to install required Android Build Tools.

Running "$ANDROID_HOME/tools/bin/sdkmanager" simply echoes a "help" prompt.

What exactly is happening here and how can I fix this so I can run "npm run android" and android related operations?

Thank you for your help

Fane
  • 1,978
  • 8
  • 30
  • 58
  • 1
    Open CMD and do: `echo %ANDROID_HOME%`. If it echoes that exact text you haven't set the `ANDROID_HOME` environmental variable. Adding the SDK root to `PATH` should do though – Zoe Nov 26 '17 at 16:16
  • @zoe I forgot to mention I am using OS X. And as I said in the question `$ANDROID_HOME paths to the following: /Users//Library/Android/sdk` so doing `echo $ANDROID_HOME` echoes that same path. I really don't understand why this should be happening. Any other idea? – Fane Nov 26 '17 at 23:50
  • Not familiar with os x but there's a `//` in there. If that isn't a typo here or supported by os x, remove one of them – Zoe Nov 27 '17 at 05:46
  • @Zoe that's a typo – Fane Nov 27 '17 at 08:41

3 Answers3

19

Solved by executing $ANDROID_HOME/tools/bin/sdkmanager "build-tools;25.0.2"

Fane
  • 1,978
  • 8
  • 30
  • 58
  • if you don't know the build-tools versions you have, you can do `ls $ANDROID_HOME/build-tools` (if you have your android home env var setup correctly, that is) – Corey Cole Aug 16 '18 at 20:28
  • Also, according to nativescript docs, you need 27.0.3 or later https://docs.nativescript.org/start/ns-setup-os-x – Corey Cole Aug 16 '18 at 20:32
3

The solution for me, needing the version 33 was:

  1. Add this to your ~/.zshrc or similar

    export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/platform-tools

  2. Download the 33.0.2 from here.

  3. On your $HOME/Library/Android/sdk/build-tools delete the 34.0.0, and copy the downloaded one, but rename its folder from android-13 to 33.0.2

  4. On Android Studio SDK Manager>SDK Tools> Download the Android SDK CLI

  5. On your terminal run $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "build-tools;33.0.2"

  6. ns doctor android should be fine now. Enjoy !

Arco Voltaico
  • 860
  • 13
  • 29
0

I ran into this issue when I installed Android Studio and dependencies before installing nativescript. What solved the issue for me was:

  1. uninstall/reinstall Android Studio

  2. Set Android_Home and ANDROID_SDK_ROOT to the location of the sdk that android studio is pointed too.

  3. restart terminal run tns doctor again.

justTech
  • 25
  • 1
  • 5