0

i was looking for answer to this question and found this Cannot find a compatible Android SDK for compilation when running `tns platform add android` But none of the answers helped me, it still throws error. Here is what i'm doing:

  1. Installed chocolatey
  2. installed everything like in tutorial
  3. Cloned sample project and so on
  4. Trying to "tns platform add android" and got
    Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.

My setup is Windows7 x32, and it's my first time to try nativescript (which looks really powerful at the sample video), and i'm really interested in it, can someone help me with this problem?

Community
  • 1
  • 1
Alex K
  • 173
  • 2
  • 13
  • Did you install the Android SDK? Think you can open your console and type `echo ANDROID` and see what that returns. It should return the path to the Android SDK if it is set/exists. – Brad Martin May 02 '16 at 13:54
  • When i do `echo %ANDROID_HOME%` it throws `C:\Users\Username\AppData\Local\Android\android-sdk` – Alex K May 03 '16 at 11:41

2 Answers2

1

Did you install the sdk platform & tools ? If not run android from the command prompt the sdk manager should open then you can install the tools required (Android SDK Tools, Android SDK Platform-tools & Android SDK Build-tools). After try running tns platform add android again ..:)

Osei Fortune
  • 831
  • 6
  • 12
  • I have installed android several times - with chocolatey and downloading android studio, and `tns platform add android` gives the same error all the time. Now i tried to set PATH variable to paths to Android sdk/tools and /platform-tools manually, and then do tns thing, but it throws the same arror again. BTW i'm on windows cmd, and `echo ANDROID` just writes ANDROID in terminal, and `android` says `there is no such inner or outer command`. When i do `echo %ANDROID_HOME%` it throws `C:\Users\Username\AppData\Local\Android\android-sdk` – Alex K May 03 '16 at 11:36
1

Looks like i've found answer to my own question again.
I looked at Set Up Windows guide and at the line
Install the required Android SDKs and the Local Maven repository for Support Libraries.
with code echo yes | "%ANDROID_HOME%\tools\android" update sdk --filter tools,platform-tools,android-23,build-tools-23.0.2,extra-android-m2repository,extra-google-m2repository,extra-android-support --all --no-ui
bug appeared here, nothing actually installed nor updated, i should get everything at right from the | in that code and run it in cmd, answering y on all questions. That helped, but thanks for all answers, it made me look one more time at docs.

Alex K
  • 173
  • 2
  • 13