After upgrading to Android Studio 2.0 Preview I see the following exception when I try to build a project
Error:Internal error: (java.lang.ClassNotFoundException) com.android.repository.io.FileOpUtils
java.lang.ClassNotFoundException: com.android.repository.io.FileOpUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.android.sdklib.repository.local.LocalSdk.<init>(LocalSdk.java:182)
at com.android.sdklib.repository.local.LocalSdk.<init>(LocalSdk.java:191)
at org.jetbrains.jps.android.AndroidBuildDataCache.getSdk(AndroidBuildDataCache.java:145)
at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidTarget(AndroidJpsUtil.java:403)
at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidPlatform(AndroidJpsUtil.java:478)
at org.jetbrains.jps.android.builder.AndroidPreDexBuildTarget.computeRootDescriptors(AndroidPreDexBuildTarget.java:110)
at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.addRoots(BuildRootIndexImpl.java:72)
at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.<init>(BuildRootIndexImpl.java:62)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:83)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:266)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
It is a known issue but any comments there are "me too".
Has anyone been able to workaround this?
Update
This issue has been resolved in 2.0 Preview 4.
A workaround was posted in a comment to the issue filed.
On my Mac I performed the following steps in a Terminal:
vi /Applications/Android\ Studio.app/Contents/plugins/android/lib/android.jar
Select META-INF/plugin.xml for editing.
Add ;repository.jar to the classpath attribute in the line <compileServer.plugin classpath="sdklib.jar;common.jar;jarutils.jar;layoutlib-api.jar;manifest-merger.jar"/> and save changes.
Open Android Studio
As mentioned in the comment you may need to apply this workaround again after further updates to Android Studio if the issue still hasn't been resolved.
Warning
After applying the above changes Android Studio is no longer able to apply patch updates. You get a warning like that shown in this question. It seems the only solution is a re-install. According to the comments on the issue though the problem still exists in the latest build.
Related
I have an app that pass a lint test on circleCI, but fail on local machine with the following error
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3090)
at java.base/java.lang.Class.getConstructor0(Class.java:3295)
at java.base/java.lang.Class.newInstance(Class.java:532)
at org.jetbrains.kotlin.cli.jvm.plugins.ServiceLoaderLite.loadImplementations(ServiceLoaderLite.kt:50)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension$loadProcessors$efficientProcessorLoader$1.doLoadProcessors(Kapt3Extension.kt:83)
at org.jetbrains.kotlin.kapt3.base.ProcessorLoader.loadProcessors(ProcessorLoader.kt:45)
at org.jetbrains.kotlin.kapt3.base.ProcessorLoader.loadProcessors$default(ProcessorLoader.kt:28)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.loadProcessors(Kapt3Extension.kt:88)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:171)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:98)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:82)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:384)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:70)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:375)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:123)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:131)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:103)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:442)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:1027)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:1069)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:1026)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:441)
at jdk.internal.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 48 more
I do not use JAXB and I have no idea where does this come from. More frustrating is I can build my app without any error.
I have tried the solutions in the following links, but none of them works for my case.
https://www.concretepage.com/questions/556
How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
Has anyone experienced similar issues?
The JAXB APIs are considered to be J2EE APIs, therefore not present default class path in Java SE 9. In JDK 11 they are completely removed. But, these Java EE APIs that were provided in JDK 6/7/8 are still in the JDK.
Edit 10/2020:
I ran into this issue again some time ago when CircleCi update their java image from jdk8 to jdk11. I was able to solve this issue by updating the Gradle tool. Looks like in the latest version of Gradle lint no longer use JAXB APIs.
Old answer: Today I finally solve this issue. Here is what I did.
I attempted to solve this issue by reinstalling Android Studio 3.4. However I couldn't even start up Android Studio and I ran into this
java.lang.RuntimeException:
com.intellij.ide.plugins.PluginManager$StartupAbortedException:
Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
Then I looked for answers and came across this page
[Can't start Android Studio][1]
[1]: https://superuser.com/questions/1391452/cant-start-android-studio
I reverted back to use jdk 8.
Android Studio 3.4 finally started up, and JAXBException was gone.
I've a Xamarin Android app running on Visual Studio 2015. Since a few days I'm no longer able to edit XML layout files into Android Designer getting the following error:
java.lang.NoClassDefFoundError: com/android/utils/ILogger
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.android.utils.ILogger
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
Exception in thread "main"
I've already tried to update JAVA (to jdk 1.8) and setting it, update Xamarin to the lastest version and installed almost all missing Android SDK versions and tools.
Any idea on how to fix it to come back to edit & visualize Android xml/axml layout activities?
In my case it was fixed by removing the Preview Channel Packages and install the previous version packages.
Open Android SDK Manager and delete "Tools (Preview Channel) > Android SDK Tools". Install previous version Android SDK Platform Tools (in my case Rev 23.1)
The problem is as follows, during startup of the jzy3d demo ScatterDemo.java :
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile
at org.jzy3d.chart.Settings.<init>(Settings.java:19)
at org.jzy3d.chart.Settings.getInstance(Settings.java:48)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:18)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:13)
at org.jzy3d.demos.scatter.ScatterDemo.main(ScatterDemo.java:16)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLProfile
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 more
Java Result: 1
Configuration is NetBeans 7.3.1, jzy3d-api-0.9.1, jzy3d-swt-0.9.1, log4j-1.2.17, gluegen-rt (latest stable), jogl-all (latest stable), JDK1.7
I am aware of the following change (Moving all of javax.media.opengl to com.jogamp.opengl, https://jogamp.org/bugzilla/show_bug.cgi?id=682). I have gone through the usual process of including .jar files into the project.
Project compiles fine, does not run.
My question(s) are: Can I somehow redirect javax.media.opengl.* to com.jogamp.opengl.* ? What is the correct way to resolve this problem?
As you can see here, even the code on the master branch (0.9.2) isn't based on the latest version of JOGL. Please ask Martin Pernollet to make the necessary changes (replace javax.media.* by com.jogamp.*) or do it yourself. You can rebuild Jzy3d to test it with the modifications of the import clauses. This is the correct way of solving this simple problem.
I'm trying to make a Java program that can communicate with JavaDB. I've made the Database class, started a server and made a tiny client program to check if they would communicate.
The program crashes when i try to run it, giving a class not found exception at the line where i try to set the database driver. I googled it and found that this error appears if derbyclient.jar and derby.jar are not found in the classpath. I also read that the scripts setNetworkClientCP and setNetworkServerCP found in the db directory would set these in the classpath. I found the scripts, ran them, and checked to make sure the classpath got updated, but i still get the same error. Does anyone know what the problem might be?
EDIT: SOLVED - i just realized that i need to include the derbyclient.jar in the NetBeans project library.
I'm using NetBeans and the built in JavaDB. I set the classpath by using the scripts that i mentioned above, and upon checking the classpath i found these entries:
%DERBY_INSTALL%\lib\derbyclient.jar;
%DERBY_INSTALL%\lib\derby.jar;
%DERBY_INSTALL%\lib\derbytools.jar;
%DERBY_INSTALL%\lib\derbynet.jar;
The Error:
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at Database.<init>(Database.java:14)
at TestKlient.main(TestKlient.java:8)
I've been on google and android support forums for more than 8 hours now with no luck. My Android studio was working fine 2 days ago and last night when I wanted to continue my project, I got this error :
Render error
ActiveTool: com.intellij.designer.designSurface.tools.SelectionTool#7797899
SDK: Android 4.4.2 - API 19
java.lang.NoClassDefFoundError: org/kxml2/io/KXmlParser
at com.android.ide.common.resources.IdResourceParser.parse(IdResourceParser.java:75)
at com.android.ide.common.resources.IdGeneratingResourceFile.parseFileForIds(IdGeneratingResourceFile.java:150)
at com.android.ide.common.resources.IdGeneratingResourceFile.load(IdGeneratingResourceFile.java:72)
at com.android.ide.common.resources.ResourceFolder.getFile(ResourceFolder.java:286)
at com.android.ide.common.resources.ResourceFolder.processFile(ResourceFolder.java:74)
at org.jetbrains.android.sdk.FrameworkResourceLoader$IdeFrameworkResources.ensureInitialized(FrameworkResourceLoader.java:124)
at org.jetbrains.android.sdk.FrameworkResourceLoader.loadPlatformResources(FrameworkResourceLoader.java:60)
at org.jetbrains.android.sdk.FrameworkResourceLoader.load(FrameworkResourceLoader.java:54)
at org.jetbrains.android.sdk.AndroidTargetData.getFrameworkResources(AndroidTargetData.java:207)
at com.android.tools.idea.configurations.ResourceResolverCache.getFrameworkResources(ResourceResolverCache.java:248)
at com.android.tools.idea.configurations.ResourceResolverCache.getFrameworkResources(ResourceResolverCache.java:214)
at com.android.tools.idea.configurations.ResourceResolverCache.getResourceResolver(ResourceResolverCache.java:129)
at com.android.tools.idea.configurations.Configuration.getResourceResolver(Configuration.java:1137)
at com.android.tools.idea.rendering.RenderService.getResourceResolver(RenderService.java:276)
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:469)
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:691)
at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:483)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: org.kxml2.io.KXmlParser PluginClassLoader[org.jetbrains.android, 10.0]
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:68)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 30 more
Anyone got some thoughts on this? Oh yeah, The first time I used android studio, it was online, then it work, then offline, still worked and now it doesn't work again.
My setup :
Windows 8.1 pro 64-bit
Java JDK 1.7 64-bit
I tired changing the API level, but still no results. Here is a screenshot :
http://snag.gy/bSr7y.jpg
If there is already a thread on this, please point me to it and I'll remove this one. I did a quick search on StackOverflow and couldn't see anything.
Thanks in advance
Solution :
Turns out, my JDK was corrupt and it didn't fully remove the installation when uninstalled.
I finally got it fixed. Here is what I did :
First, I uninstalled Java JDK1.7 and removed all it's left over files.
Then I downloaded and installed JDK1.8 and it worked.
I had an error where the Studio said it couldn't detect JDK, so I only added an JAVA_HOME environment variable which points to my new JDK and it's all working fine now. Thanks everyone for the help and suggestions. I hope this can help someone in the future.
I dont know what the exact problem was ...
But NoClassDefFoundError is kind of hard ...
Anyway try this post
3 ways to solve java.lang.NoClassDefFoundError in Java
Check the XmlParser class (try commenting any class calls)
above link describes how this error gets generated