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 :
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.