【问题标题】:How do i resolve problem render view in Android 3.6如何解决 Android 3.6 中的渲染视图问题
【发布时间】:2020-02-28 15:23:57
【问题描述】:

谁能帮我解决这个问题。最近将Android 3.5升级到3.6,然后布局文件报错:
Render problem: Exception raised during rendering (Details).
虽然我创建了一个新项目,如下图所示,但在布局文件中只有一个 TextClock 视图。 Image

堆栈跟踪:

java.lang.NullPointerException
    at android.content.ContentResolver.registerContentObserver(ContentResolver.java:2263)
    at android.widget.TextClock.registerObserver(TextClock.java:626)
    at android.widget.TextClock.onAttachedToWindow(TextClock.java:545)
    at android.view.View.dispatchAttachedToWindow(View.java:19575)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
    at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:335)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:396)
    at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:209)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:608)
    at com.android.tools.idea.rendering.RenderTask.lambda$inflate$6(RenderTask.java:734)
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

谢谢

编辑:这是 Android Studio 错误。有关更新信息,请参阅 issueTracker

【问题讨论】:

  • 同样的情况。 TextClock 可能有问题。我添加了堆栈跟踪。

标签: android android-studio android-studio-3.6


【解决方案1】:

将此添加到 build.gradle

android{
.....
 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-31
    • 2019-11-12
    • 1970-01-01
    • 2010-09-17
    • 2021-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多