First of all, I am very new to Nativescript. I am in the process of trying to set it up on windows 10. I have all the tools installed as far as I can tell and have made sure my android environment is setup. When I type android at the cli I get the sdk manager and have them installed (sdk build tools etc).
Java is at version 1.7.0_55 on my box and that seems fine. What is not fine is that Nativescript insists my ANDROID_HOME is not set or is invalid.
I have run a doctor script which I include (attached)
log.txt
I looked at the first error which was adb help and I ran that command directly from the same shell I got the following output from adb.exe
The reason I am filing this issue is because I receive an errror when trying to add a platform using
tns platform add android
When I issue this command I get the following message:
The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
This appears not to be the case. And so I am filing an issue as I cannot add the android platform to my app.
Java 1.7 is already deprecated. Can you try to update to latest to see if the problem will go away?
You can check {N} system requirements here:
https://github.com/NativeScript/nativescript-cli#system-requirements
First you need Java 1.8.
Re ANDROID_HOME, can you try this: echo %ANDROID_HOME%
Also after installing Android SDK you need to install those things:
Android SDK 22 or a later stable official release
Android SDK Build-tools 23.0.0 or a later stable official release
Local Maven repository for Support Libraries
Ok so I updated java to the latest jdk and unfortunately that has not sorted the issue I include everything I can think of to help diagnose.
I should point out that my android_home points to:
"c:\program files (x86)\Android\android sdk"
which is where the sdk is installed :)
I have gone back and looked at this, and I suddenly realised the base tools were installed by visual studio. What I did was to uninstall android dev kit and reinstall using android studio, I updated android home to the location studio was using and doctor is now satisfied.
I have the same issue on Windows. My nativescript installs successfully but when I run tns doctor I get the following:
WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the nati
ve emulator.
To be able to build for Android and run apps in the native emulator, verify that
you have
installed the latest Android SDK and its dependencies as described in http://dev
eloper.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the ch
ocolatey package manager to install the Android SDK and its dependencies.
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or
later.
Cannot find a compatible Android SDK for compilation. To be able to build for An
droid, install Android SDK 22 or later.
Run $ android to manage your Android SDK versions.
You need to have Android SDK 22 or later and the latest Android Support Reposito
ry installed on your system.
Run $ android to manage the Android Support Repository
I have many 22+ SDKs available and installed. Could it be the location ?
Running echo %ANDROID_HOME% gets me this:
P:\>echo %ANDROID_HOME%
C:\Users\aawad\AppData\Local\Android\android-sdk
Also running the following:
P:>echo %ANDROID_HOME%
C:\Users\UID\AppData\Local\Android\android-sdk
P:>javac -version
javac 1.8.0_102
P:>java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Any suggestions ?
Thank you !
I鈥檓 having basically the exact same issue as @tonyawad88. The installation script ran successfully, and everything is set up, but tns doctor spits out what appear to be false positive messages about Android SDK issues.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ android 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 to manage the Android Support Repository.
it is turned out that: setting ANDROID_HOME to "c:\program files (x86)\Android\android sdk" as in the tutorial is the one causing this issue.
You should change it to C:\Users\UID\AppData\Local\Android\android-sdk
then in command line, type refreshenv
After that, everything should be ok
@hnguyenec I assume you鈥檙e referring to this article that needs to be updated, correct? https://github.com/NativeScript/docs/blob/production/start/ns-setup-win.md
We should definitely update the docs, but I think there鈥檚 still a problem in the script, as when I ran through this it set my ANDROID_HOME to an incorrect location.
Any update on this? I am having the exact same issue as pointed out by @tonyawad88 and @tjvantoll
I encountered the same issue with @tonyawad88 and @tjvantoll, finally, I changed the environment Variable ANDROID_HOME to a real Android SDK directory(installed android manually), then run tns doctor, it showed No issues were detected.
The default ANDROID_HOME was set to _C:\Users\Uid\AppData\Local\Android\android-sdk_ after Nativescript set up script running, I assume this is not a whole Android SDK directory, so such info was shown.
Hi i have @tonyawad88 and @tjvantoll same problem and my sdk path in folder d: and i can not find any \android-sdk in C:\Users\Uid\AppData\Local\Android\android-sdk path
Remove the User Variable
Add the System Variable ANDROID_HOME
Point the System Variable to C:\Program Files (x86)\Android\android-sdk
Exit prompt and Open new Prompt and try again
After install.
ANDROID_HOME = C:\Users\Usr\AppData\Local\Android\android-sdk
but the route not exist, i access to C:\Users\Usr\AppData\Local\Android and i can see the folder sdk so i change.
ANDROID_HOME = C:\Users\Usr\AppData\Local\Android\sdk
and it works
I try do it on linux
export ANDROID_HOME='/media/destructor/Media/Install/Linux/android-sdk-linux/'
but get next warnings
WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the native emulator.
To be able to build for Android and run apps in the native emulator, verify that you have
installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.
The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the ANDROID_HOME variable to point to the root of your Android SDK installation directory.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ sdkmanager to manage your Android SDK versions.
You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=26'.
Run $ sdkmanager from your command-line to install required Android Build Tools. In case you already have them installed, make sure ANDROID_HOME environment variable is set correctly.
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ sdkmanager to manage the Android Support Repository. In case you already have it installed, make sure ANDROID_HOME environment variable is set correctly.
Can only confirm @Rombersoft 's comment. This _does not work_ on Linux. It's about what I've come to expect of Android toolchain stuff, but it's still appalling.
I have the same problem, on mac :(
Not sure if this helps anyone but I had the same issue on Linux (Ubuntu) after issuing:
sudo npm install nativescript -g --unsafe-perm
However, in the end I realised it was my environment variables not being carried forward to _sudo_. Once, I added:
Defaults env_keep += "ANDROID_HOME JAVA_HOME"
to the bottom of /etc/sudoers it worked perfectly.
@LuisGhz It worked like charm. I think NativeScript is looking for the SDK path "C:\Users\Usr\AppData\Local\Android\sdk" which i set as the "ANDROID_HOME" environment variable, not this "C:\Usr\Android\android-sdk" . I have spent my time download un-necessary packages.
installing sidekick solved my issue
updating SDK in AndroidStudio >> Preferenceswould help

I fixed this issue by setting ANDROID_HOME to $HOME/Android/Sdk
how do you set ANDROID_HOME to $HOME/Android/Sdk?
@franconeil check this answers for setting ANDROID_HOME on Ubuntu Linux. As the originally reported issue was for setting on Windows and the last conversation threads are talking about Linux I am going to close the issue as resolved. If you have difficulties setting the ANDROID_HOME on linux please check the existing threads or open a new issue related to the Linux setup.
how do you set ANDROID_HOME to $HOME/Android/Sdk?
Enter this in your terminal
export ANDROID_HOME=$HOME/Android/Sdk
The above command only set it temporary, if you want it set every time you boot, then add that line to either ~/.zshrc or ~/.bashrc, depending on what shell you are using.
I found the error. We must add android & java home paths to system variables. Not user variables. Finally I fixed the issue
On Mac, i had the same issue and this arises because the ANDROID_H
I have the same problem, on mac :(
set ANDROID_HOME to /Users/$userid/Library/Android/sdk/ as opposed to '/usr/local/share/android-sdk/' as mentioned in this {N} documentation which must be updated.
I was using zshrc.
I have solved this issue doing this:
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_SDK_ROOT=~/Library/Android/sdk
export PATH=$PATH:~/Library/Android/sdk/platform-tools/
export PATH=$PATH:$ANDROID_HOME/tools/bin
Install JDK 8 from here, JDK 8 LINK
Install JAVA 8 by following:
brew tap adoptopenjdk/openjdk
brew cask install homebrew/cask-versions/adoptopenjdk8
^ when I run these commands (well, this working version of it: brew install --cask homebrew/cask-versions/adoptopenjdk8 )
I still get these errors when trying to use it:
Configuring your system for Android development... This might take some time, please, be patient.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
WARNING: There seem to be some problems with the Android configuration
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
WARNING: There seem to be some problems with the Android configuration
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
WARNING: There seem to be some problems with the Android configuration
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
WARNING: There seem to be some problems with the Android configuration
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
WARNING: There seem to be some problems with the Android configuration
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
WARNING: There seem to be some problems with the Android configuration
Step 5 of 12:
Do you want to install Android emulator system image? (y/n)
^CTraceback (most recent call last):
2: from -e:168:in `<main>'
1: from -e:168:in `gets'
-e:168:in `gets': Interrupt
Most helpful comment
I have the same problem, on mac :(