简体   繁体   English

Intellij Idea 预览不起作用(渲染问题)

[英]Intellij Idea preview not working (Render problem)

I've just started to learn how to create android apps, opened one of the patterns (Empty activity) and now having a strange problem.我刚刚开始学习如何创建 android 应用程序,打开其中一种模式(空活动),现在遇到了一个奇怪的问题。 I can`t see anything on the design tab of the layout.我在布局的设计选项卡上看不到任何内容。

I'm using Intellij Idea 2019.2, gradle 5.1.1 and androidx library dependencies.我正在使用 Intellij Idea 2019.2、gradle 5.1.1 和 androidx 库依赖项。 I've tried to change this我试图改变这一点

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"> 

in style.xml.在 style.xml 中。 Now I can see components in the tree, but not on the blueprint\\design.现在我可以在树中看到组件,但在蓝图\\设计上看不到。

I have this error message:我有这个错误信息:

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)

The app itself works good on the emulated android, but I want to know if there is a way to solve this error.该应用程序本身在模拟的 android 上运行良好,但我想知道是否有办法解决此错误。

Update.更新。 Components become visible in the tree only after using "Clean Project"只有在使用“Clean Project”后组件才在树中可见

It's a bug in 2019.2 and it has already been reported: https://youtrack.jetbrains.com/issue/IDEA-219113这是 2019.2 中的一个错误,已经被报告: https ://youtrack.jetbrains.com/issue/IDEA-219113

Also: https://youtrack.jetbrains.com/issue/IDEA-219232 (same issue, different stack trace).另外: https : //youtrack.jetbrains.com/issue/IDEA-219232 (相同的问题,不同的堆栈跟踪)。

I had the same problem after upgrading so I went back to 2019.1.3 which works.升级后我遇到了同样的问题,所以我回到了 2019.1.3,它有效。 So it seems that the only solution is to downgrade, until an update comes out.所以似乎唯一的解决方案是降级,直到更新出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM