New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android SDK is not installed or is not configured properly, environment looks ok #3139

Closed
ItStillDoesNotWork opened this Issue Sep 28, 2017 · 11 comments

Comments

Projects
None yet
@ItStillDoesNotWork
Copy link

ItStillDoesNotWork commented Sep 28, 2017

See #1813. This problem STILL EXISTS - despite that issue being closed for some reason - on Linux, and on Mac.

@Rombersoft
@bboydflo

@petekanev

This comment has been minimized.

Copy link
Contributor

petekanev commented Sep 28, 2017

@ItStillDoesNotWork please follow the issue template when filing an issue.

Make sure you have all the required Android SDK packages installed too, these include SDK Platform 25, Android SDK Build-Tools 25.0.2 or later, Android Support Repository, Google Repository and any other SDKs that you may need.

sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;25.0.2" "extras;android;m2repository" "extras;google;m2repository"

As per http://docs.nativescript.org/start/ns-setup-linux#advanced-setup-steps

@rhanb

This comment has been minimized.

Copy link

rhanb commented Oct 2, 2017

Hi,

Got the same issue when updating NativeScript to 3.2.1, I think it comes from the script installation which does everything for you and change your bash_profile.. A lots of MacOsX users use Zsh it may comes from this.
(javac works in the terminal)

tns --version:
3.2.1

get an error while executing:

sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;25.0.2" "extras;android;m2repository" "extras;google;m2repository"

error:

sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;25.0.2" "extras;android;m2repository" "extras;google;m2repository"
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.SdkManagerCli.main(SdkManagerCli.java:103)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
	... 4 more

.bash_profile:

source ~/.profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

###-tns-completion-start-###
if [ -f /Users/rhanb/.tnsrc ]; then
    source /Users/rhanb/.tnsrc
fi
###-tns-completion-end-###
export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1
export JAVA_HOME=/Library/Java/Home
export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1
export JAVA_HOME=/Library/Java/Home

.zshrc:

export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=/usr/local/opt/android-sdk

when updating I also got this errors:

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.SdkManagerCli.main(SdkManagerCli.java:103)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
	... 4 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.SdkManagerCli.main(SdkManagerCli.java:103)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
	... 4 more

Hope it can help

@petekanev

This comment has been minimized.

Copy link
Contributor

petekanev commented Oct 2, 2017

Hey @rhanb which JDK distribution do you have? Please make sure it's Oracle's 1.8 (Java 8) JDK.

@rhanb

This comment has been minimized.

Copy link

rhanb commented Oct 3, 2017

Hey @Pip3r4o ,

Thanks for your answer, I used the latest JDK which was downloaded from the NativeScript script which run when I updated it. Using Java 8 SDK fixed the issue 👍

@etabakov

This comment has been minimized.

Copy link
Member

etabakov commented Oct 5, 2017

Hi @rhanb, the setup script was updated to require explicitly Java 8 and the documentation was updated accordingly.

@etabakov etabakov closed this Oct 5, 2017

@GrumpyOldTroll

This comment has been minimized.

Copy link

GrumpyOldTroll commented Jan 19, 2018

I ran into this problem and found a solution that worked for me here:
https://stackoverflow.com/questions/47150410/failed-to-run-sdkmanager-list-android-sdk-with-java-9

Namely:
replacing line 31 of $ANDROID_HOME/tools/bin/sdkmanager:

# OLD:
# DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME"'
# NEW:
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
@viotti

This comment has been minimized.

Copy link

viotti commented Feb 7, 2018

Or just export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'. On Bash, YMMV.

@as-cole

This comment has been minimized.

Copy link

as-cole commented Mar 9, 2018

I am getting the exact same behavior as rhanb described above, but I am on JDK 8 (1.8), and I have tried the fix GrumpyOldTroll offered - still getting the same errors.

@germanviscuso

This comment has been minimized.

Copy link

germanviscuso commented Apr 3, 2018

Android Tools are not yet compatible with JDK 9 or 10 and by taking a look at the XmlSchema error it looks like at some point the system is using the system-wide JDK version. If you have to work with multiple Java versions (and just having a JDK 8 is not an option) you can try this: https://stackoverflow.com/questions/49630165/how-to-configure-unity-2017-4-to-target-android-and-avoid-build-failures-on-osx/49630166#49630166
(I work with multiple Java versions via jenv and this was the only sane solution I found)

@ericjasonthomas

This comment has been minimized.

Copy link

ericjasonthomas commented Jun 4, 2018

Getting same issue

@lozinskydino

This comment has been minimized.

Copy link

lozinskydino commented Jan 11, 2019

I using the currenty version of tns (5.1.0), and i solved the problem removing "--add-modules java.se.ee'"

# OLD: 
# DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.." -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee # 
NEW: 
DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.." -XX:+IgnoreUnrecognizedVMOptions

Thanks to @GrumpyOldTroll for the path to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment