Solvednativescript cli Add support for Android SDK Tools 25.2.3

A few days ago i updated my android sdk (with android-studio) and also switched from nativescript 2.4.x to 2.5.2, but during the setup (and also after executing tns doctor) it seems like nativescript is not able to find an appropriate targetSdk

Selected version is:  25.0.2
Selected targetSdk is: undefined
Selected AppCompat version is: undefined

It looks like the cli uses the android command of the sdk tools, but this command is not available anymore

spawn: .../Sdk/tools/android "list" "targets"
Result when throw error is false:
{ stdout: 'The android command is no longer available.\nFor manual SDK and AVD management, please use Android Studio.\nFor command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager\n',
  stderr: '',
  exitCode: 1 }
The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager

So i am not able to setup android for nativescript.

I am using the android sdk tools version 25.3.1 and NativeScript 2.5.2.

29 Answers

✔️Accepted Answer

I experienced the same issue.

What's funny is that I ran android from the command line to update my SDK tools (to 25.3.1). After I updated, I tried to run android again, but it failed.

This SO answer suggests that the previous version of Android SDK Tools be installed.

https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip (for mac).
https://dl.google.com/android/repository/tools_r25.2.3-windows.zip (for windows).

Just replace the old tools/ directory in the folder pointed to by your $ANDROID_HOME.

Other Answers:

@Dutchboy the fix is already in master branch, you can try it by installing @next version of CLI:

npm i -g nativescript@next

We plan to release 2.5.3 in the beginning of the next week :)

@Plamen5kov I don't think so, because if there is an API change in the Android toolings and this causes NativeScript to fail, then it is also a problem for NativeScript or their users as long as it is not documented that newer versions of the sdk don't work with NativeScript.

Hey @c1ngular , we are working on the fix and it will be available in @next version of CLI very soon. We are preparing 2.5.3 release of NativeScript CLI, where this issue will be fixed.

More Issues: