Sample Header Ad - 728x90

Everytime I try run anything Android studio related Java-related errors show up

0 votes
1 answer
2210 views
for example when I run sdkmanager this error displays:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.(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:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 5 more
and If I want to run any flutter code on my android device this error occur:
Launching lib/main.dart on VOG L29 in debug mode...
Checking the license for package Android SDK Build-Tools 30.0.3 in /opt/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 30.0.3 not accepted.
Checking the license for package Android SDK Platform 31 in /opt/android-sdk/licenses
Warning: License for package Android SDK Platform 31 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-31 Android SDK Platform 31
     build-tools;30.0.3 Android SDK Build-Tools 30.0.3
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html 

  Using Android SDK: /opt/android-sdk

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org 

BUILD FAILED in 17s
Running Gradle task 'assembleDebug'...                             18.1s
Exception: Gradle task assembleDebug failed with exit code 1
I also tried fixing the errors by acpeting licences but that also wouldn't work.
Asked by Xichao (1 rep)
Jan 25, 2023, 08:31 PM
Last activity: Jun 25, 2025, 11:08 PM