Taremeh Taremeh - 2 months ago 77
AngularJS Question

Nativescript error: tns run android - "Cannot find a compatible Android SDK"

I followed the whole Getting Started Tutorial for Mac (https://docs.nativescript.org/tutorial/chapter-1).

Now I try to get the sample app running. IOS works fine!
But Android doesn't work: Not on USB-device, either on Genymotion.

Here the error after typing in:
"tns run android"

Executing before-prepare hook from /Users/Username/Documents/Development/sample-Groceries/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 1.8.10
Processing node_modules failed. Exception: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.


I have installed Android SDK 23, as it was written in the tutorial:

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


How can I fix it? I tried everything...

Thanks!

Answer

First question I have would be, have you run tns doctor?

Be sure you have your ANDROID_HOME set correctly, pointed to your actual sdk install location, without a trailing slash at the end. here is mine as an example:

ANDROID_HOME=/sdks/android-sdk-macosx

It's also good to have the tools in the path (example snippet):

PATH='/sdks/android-sdk-macosx/tools:/sdks/android-sdk-macosx/platform-tools:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin:/Applications/Genymotion.app/Contents/MacOS'
Comments