question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

running new project on android: Exception in thread "main" java.lang.NoClassDefFoundError

See original GitHub issue

When running tns run android on fresh project scaffold:

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
rigor789commented, Feb 1, 2021

@JimLynchCodes I have a draft of the setup guide rewritten for the new docs, perhaps you can try these steps: https://gist.github.com/rigor789/7829f09b5a903fdf31799b65b902c52e

Your issue seems to be an invalid or missing ANDROID_HOME environment variable.

0reactions
rigor789commented, Feb 5, 2021

Your PATH is missing $ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools. Well, only the platform-tools is necessary the others are useful otherwise.

These were in the guide I linked btw: image

Happy to help but opening multiple issues with the same content/question won’t get you further - it’s easier to help in a single place, so I closed one of the issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in thread "main" java.lang.NoClassDefFoundError
Running as an android test deploys the test apk to the device and runs it there (under dalvik vm). A long time ago...
Read more >
3 ways to solve java.lang.NoClassDefFoundError in Java J2EE
Exception in thread “main” simply indicates that it's the “main” thread that is not able to find a particular class it could be...
Read more >
r/libgdx - getting Exception in thread "main" java.lang ... - Reddit
I am getting the java.lang.NoClassDefFoundError when I click 'run with coverage' and run the desktoop launcher. I know what java.lang.
Read more >
NoClassDefFoundError when trying to run a scratch file in ...
When trying to instantiate a class from my Android Studio project in a scratch file I get a NoClassDefFoundError. ... Exception in thread...
Read more >
Exception in thread "main" java.lang.NoClassDefFoundError
It's denoted by java.lang.NoClassDefFoundError and comes when that particular class is present during compile time but somehow not available during runtime.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found