如何在IntelliJ IDEA中修复“渲染问题”,“ java.lang.NoClassDefFoundError:sun / misc / Cleaner”?

时间:2019-08-12 13:05:46

标签: android android-studio intellij-idea kotlin

我正在跟踪Google在Udacity上针对Android开发的Kotlin应用程序(代码在https://github.com/udacity/andfun-kotlin-guess-it/上),每当我尝试访问任何fragment.xml文件的设计视图时,IntelliJ都会显示“渲染问题”错误。不显示任何布局元素(仅空白和蓝色屏幕)。它还向我显示此错误:

java.lang.NoClassDefFoundError: sun/misc/Cleaner
at libcore.util.NativeAllocationRegistry.registerNativeAllocation_Original(NativeAllocationRegistry.java:130)
at libcore.util.NativeAllocationRegistry_Delegate.registerNativeAllocation(NativeAllocationRegistry_Delegate.java:66)
at libcore.util.NativeAllocationRegistry.registerNativeAllocation(NativeAllocationRegistry.java:119)
at android.os.Binder.<init>(Binder.java:404)
at com.android.internal.view.IInputMethodClient$Stub.<init>(IInputMethodClient.java:18)
at android.view.inputmethod.InputMethodManager$1.<init>(InputMethodManager.java:606)
at android.view.inputmethod.InputMethodManager.<init>(InputMethodManager.java:606)
at android.view.inputmethod.InputMethodManager_Delegate.getInstance(InputMethodManager_Delegate.java:43)
at android.view.inputmethod.InputMethodManager.getInstance(InputMethodManager.java:681)
at com.android.layoutlib.bridge.impl.RenderAction.setUp(RenderAction.java:245)
at com.android.layoutlib.bridge.impl.RenderAction.init(RenderAction.java:133)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.init(RenderSessionImpl.java:163)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:383)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:511)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$4(RenderTask.java:640)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: sun.misc.Cleaner PluginClassLoader[org.jetbrains.android, 10.3.3] com.intellij.ide.plugins.cl.PluginClassLoader@25058ce2
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:75)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 22 more

我已经尝试过使缓存无效并重新启动应用程序,清理项目,重新同步Gradle并更改设计视图中的其他设置,例如API级别和应用程序主题。

我正在使用Android API 28和Java版本1.8

我希望能够使用“设计视图”选项卡并消除错误。

1 个答案:

答案 0 :(得分:1)

新版本的Intellij IDEA中应该有一个修复程序

请参见https://youtrack.jetbrains.com/issue/IDEA-219113#focus=streamItem-27-3621529.0-0

德米特里·杰梅罗夫的职位

BR沃尔夫冈