I have window 10 and run avdmanager but it show me "exception". How to fix it?
C:\Users\hoade\AppData\Local\Android\Sdk\tools\bin>avdmanager list avd
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.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
I also using this java version
openjdk 11.0.16.1 2022-08-12
OpenJDK Runtime Environment Temurin-11.0.16.1+1 (build 11.0.16.1+1)
OpenJDK 64-Bit Server VM Temurin-11.0.16.1+1 (build 11.0.16.1+1, mixed mode)
Related
I have written many E2E tests for an Android app which is developed with the Jetpack Compose way. I want to add those tests to my CI/CD pipeline on Microsoft Azure pipelines. After building and signing the app, I try to install AVD files, create and start the emulator in the background as it is posted on Microsoft azure documentations. I keep getting the following error about the XMLSchema.
Generating script.
========================== Starting Command Output ===========================
/bin/bash /Users/runner/work/_temp/be1cec62-f6f6-4aef-8d5c-4850153086aa.sh
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:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
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.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
# Automatically trigger build when `main` or a `release/*` branch is updated.
# This ensures that we always have an up to date representation of `main` on
# App Center, and that `release` branches automatically build for convenience.
trigger:
- release/*
- main
pr:
- '*'
variables:
# Depending of the execution context the source branch location changes
GIT_FULL_BRANCH_NAME: $[coalesce(variables['System.PullRequest.SourceBranch'], variables['Build.SourceBranch'])]
# With trunk based development, release/* signifies the release branch
IS_RELEASE_BRANCH: $[startsWith(variables['GIT_FULL_BRANCH_NAME'], 'refs/heads/release/')]
pool:
vmImage: "macos-latest"
stages:
- stage: buildAndDeploy
displayName: "Build & Deploy to App Center"
jobs:
- job: "buildAndDeploy"
steps:
- task: UpdateAndroidVersionGradle#1
inputs:
buildGradlePath: "$(Build.SourcesDirectory)/app/build.gradle"
versionName: "0.0.0"
versionCode: $(Build.BuildId)
displayName: "Set Version & Build Number"
condition: eq(variables.IS_RELEASE_BRANCH, false)
- task: PowerShell#2
inputs:
targetType: 'inline'
script: |
# Ensure that Java version 11 is used
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_11_X64)"
echo "##vso[task.setvariable variable=PATH]$(JAVA_HOME_11_X64)\bin;$(PATH)"
displayName: "Set Java v11"
- task: Gradle#2
displayName: "Build APK"
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: false
tasks: 'clean build'
- task: AndroidSigning#3
displayName: "Sign APK"
inputs:
apkFiles: "$(Build.SourcesDirectory)/app/build/outputs/apk/release/app-release-unsigned.apk"
apksign: true
apksignerKeystoreFile: 'AppName-keystore.jks'
apksignerKeystorePassword: '$(apksignerKeyPassword)'
apksignerKeystoreAlias: 'AppName'
apksignerKeyPassword: '$(apksignerKeyPassword)'
apksignerArguments: "--out $(Build.SourcesDirectory)/app/build/outputs/apk/release/app-release-signed.apk"
zipalign: false
- bash: |
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-28;google_apis;x86'
echo "AVD system-image successfully downloaded and installed."
displayName: 'Download and install emulator image'
condition: ne(variables.AVD_IMAGES_RESTORED, 'true')
- bash: |
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n android_emulator -k 'system-images;android-28;google_apis;x86' -d 17 --force
echo "Emulator created successfully $(ANDROID_HOME/emulator/emulator -list-avds), launching it"
nohup $ANDROID_HOME/emulator/emulator -avd android_emulator -skin 1080x1920 -no-snapshot -no-audio -no-boot-anim -accel auto -gpu auto -qemu -lcd-density 420 > /dev/null 2>&1 &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done'
$ANDROID_HOME/platform-tools/adb devices echo "Emulator started"
displayName: 'Create and start emulator'
- bash: |
./gradlew connectedDebugAndroidTest --stacktrace
./gradlew --stop
displayName: 'Run Instrumented Tests'
continueOnError: true
so i tried changing my jdk from jdk8 to jdk12
and it's now crashing whenever i try to start it.
the
sudo /Applications/Android\ Studio.app/Contents/MacOS/studio
works for me when i try to launch my android studio
but then i dont work when i manually select android studio application
and it show this error:
nternal error. Please report to https://code.google.com/p/android/issues
java.lang.RuntimeException: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:224)
at com.intellij.idea.IdeaApplication.lambda$initApplication$0(IdeaApplication.java:77)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:348)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
at com.intellij.ide.plugins.PluginManager.handleComponentError(PluginManager.java:258)
at com.intellij.openapi.components.impl.PlatformComponentManagerImpl.handleInitComponentError(PlatformComponentManagerImpl.java:43)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:504)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:104)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$createComponents$9(ApplicationImpl.java:447)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
at com.intellij.openapi.application.impl.ApplicationImpl.createComponents(ApplicationImpl.java:471)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:88)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:405)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:391)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:217)
... 15 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:157)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:76)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:82)
at org.jetbrains.android.sdk.AndroidSdkData.<init>(AndroidSdkData.java:139)
at org.jetbrains.android.sdk.AndroidSdkData.getSdkData(AndroidSdkData.java:104)
at org.jetbrains.android.sdk.AndroidSdkData.getSdkData(AndroidSdkData.java:78)
at org.jetbrains.android.sdk.AndroidSdkData.getSdkData(AndroidSdkData.java:112)
at org.jetbrains.android.sdk.AndroidSdkData.getSdkData(AndroidSdkData.java:119)
at org.jetbrains.android.sdk.AndroidPlatform.parse(AndroidPlatform.java:86)
at org.jetbrains.android.sdk.AndroidSdkAdditionalData.getAndroidPlatform(AndroidSdkAdditionalData.java:127)
at org.jetbrains.android.sdk.AndroidPlatform.getInstance(AndroidPlatform.java:68)
at com.android.tools.idea.sdk.IdeSdks.getEligibleAndroidSdks(IdeSdks.java:600)
at com.android.tools.idea.sdk.IdeSdks.getFirstAndroidSdk(IdeSdks.java:193)
at com.android.tools.idea.sdk.IdeSdks.getAndroidSdkPath(IdeSdks.java:119)
at com.android.tools.idea.startup.GradleSpecificInitializer.setupSdks(GradleSpecificInitializer.java:304)
at com.android.tools.idea.startup.GradleSpecificInitializer.run(GradleSpecificInitializer.java:128)
at com.android.tools.idea.AndroidInitialConfigurator.activateAndroidStudioInitializerExtensions(AndroidInitialConfigurator.java:202)
at com.android.tools.idea.AndroidInitialConfigurator.<init>(AndroidInitialConfigurator.java:71)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:85)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:62)
at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:45)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:462)
... 27 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema PluginClassLoader[org.jetbrains.android, 10.3.4.2] com.intellij.ide.plugins.cl.PluginClassLoader#71677abb
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:49)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 55 more
I tried reinstalling my android studio but still same error.
Know the compatibility of JDK for your version IntelliJ. Here is the link https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under
Make sure your computer has the path for java. Try "java -version" in cmd to know your version.
Try running with admin privilege.
I've installed Android Studio on debian Linux (sid). According to the installation instructions, I have run
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
but upon start, Android Studio crashes, complaining about missing libXrender.so.1:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
at com.intellij.idea.Main.main(Main.java:86)
Caused by: java.lang.UnsatisfiedLinkError: /home/phihag/android-studio/jre/jre/lib/amd64/libawt_xawt.so: libXrender.so.1: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at java.awt.Toolkit$3.run(Toolkit.java:1636)
at java.awt.Toolkit$3.run(Toolkit.java:1634)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1633)
at java.awt.Toolkit.<clinit>(Toolkit.java:1668)
at java.awt.Cursor.<clinit>(Cursor.java:195)
at javax.swing.text.html.HTMLEditorKit.<clinit>(HTMLEditorKit.java:623)
at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:101)
at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:74)
... 6 more
Also, an UI exception occurred on attempt to show above message:
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
at java.awt.Component.<clinit>(Component.java:594)
at com.intellij.idea.Main.showMessage(Main.java:198)
at com.intellij.idea.Main.showMessage(Main.java:174)
at com.intellij.idea.Main.showMessage(Main.java:153)
at com.intellij.idea.Main.main(Main.java:89)
The installation instructions are incomplete and assume the (x86_64) system already has various common graphical libraries installed. You also need to install:
sudo apt install libxrender-dev libxtst6 libfreetype6
Hi I am trying to open uiautomatorviewer after installing androidsdk-uiautomatorviewer in ubuntu 14.04
Everytime i am trying to open uiautomator viewer I am getting the following error.
root#xxxxxxx-HP-Z400-Workstation:/home/xxxxx# uiautomatorviewer
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jface/window/ApplicationWindow
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jface.window.ApplicationWindow
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 14 more
Could not find the main class: com.android.uiautomator.UiAutomatorViewer. Program will exit.
I dint understand why this? i have set path for sdk tools and platform-tools. please help me to get out of it.
To fix it, modify /usr/bin/uiautomatorviewer with this patch:
--- /usr/bin/uiautomatorviewer.ori 2015-03-31 12:23:52.307244926 +0200
+++ /usr/bin/uiautomatorviewer 2015-03-31 12:28:19.849396991 +0200
## -74,5 +74,6 ##
done
jarpath="$frameworkdir/$jarfile"
+deps="$frameworkdir:/usr/lib/eclipse/plugins"
-exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -Dcom.android.uiautomator.bindir="$progdir" -jar "$jarpath" "$#"
+exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$deps" -Dcom.android.uiautomator.bindir="$progdir" -jar "$jarpath" "$#"
I just reported the bug here: https://bugs.launchpad.net/ubuntu/+source/androidsdk-tools/+bug/1438629
EDIT: Or better:
sudo ln -s ../../lib/eclipse/plugins/org.eclipse.jface_3.8.0.dist.jar /usr/share/java
sudo ln -s ../../lib/eclipse/plugins/org.eclipse.core.commands_3.6.1.dist.jar /usr/share/java
I upgraded to Android SDK Tools r8 today and I can't seem to run the draw9patch tool. I'm getting the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jdesktop/swingworker/SwingWorker
at com.android.draw9patch.Application$1.run(Application.java:48)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: org.jdesktop.swingworker.SwingWorker
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 9 more
I'm running snow leopard and have jre (or jdk?) 1.6.
Any ideas how to get this working? Thanks!
I have found a solution(Ubuntu 10.10, java-6-sun). Copy swing-worker.jar into /path_to_android_sdk/tools/lib. You can find swing-worker-1.1.jar in the same directory in SDK r7 or download it from here.