PointerException异常上渲染的Andr​​oid布

PointerException异常上渲染的Andr​​oid布

本文介绍了NullPointerException异常上渲染的Andr​​oid布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid项目中的任何布局,产生渲染的异常:

Android的工作室1.2测试版

 显示java.lang.NullPointerException
    在com.android.layoutlib.bridge.impl.RenderSessionImpl.isThemeAppCompat(RenderSessionImpl.java:1203)
    在com.android.layoutlib.bridge.impl.RenderSessionImpl.findStatusBar(RenderSessionImpl.java:1066)
    在com.android.layoutlib.bridge.impl.RenderSessionImpl.init(RenderSessionImpl.java:209)
    在com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:319)
    在com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    在com.android.tools.idea.rendering.RenderTask $ 2.compute(RenderTask.java:497)
    在com.android.tools.idea.rendering.RenderTask $ 2.compute(RenderTask.java:485)
    在com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
    在com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:485)
    在com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:590)
    在com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)
    在com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
    在com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
    在com.intellij.util.ui.update.MergingUpdateQueue $ 2.run(MergingUpdateQueue.java:254)
    在com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
    在com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
    在com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
    在com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    在com.intellij.util.Alarm $ $请求1.run(Alarm.java:351)
    在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471)
    在java.util.concurrent.FutureTask.run(FutureTask.java:262)
    在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    在java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:615)
    在java.lang.Thread.run(Thread.java:745)


解决方案

切换preVIEW月22日至21渲染目标做出错误走开我在Android 1.2工作室稳定。

Any layout in my android project, generate a render exception:

Android Studio 1.2 Beta

java.lang.NullPointerException
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.isThemeAppCompat(RenderSessionImpl.java:1203)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.findStatusBar(RenderSessionImpl.java:1066)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.init(RenderSessionImpl.java:209)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:319)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:497)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:485)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:485)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:590)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)
    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:351)
    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:745)
解决方案

Switching the preview rendering target from 22 to 21 made the error go away for me on Android Studio 1.2 Stable.

这篇关于NullPointerException异常上渲染的Andr​​oid布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 14:29