Android Stduio 2.2预览2使用WindowDecorActionBar渲染问题

时间:2016-05-30 07:25:58

标签: android exception android-studio layout android-studio-2.2

我在android studio 2.2预览2中查看布局时收到以下消息:

Rendering Problems The following classes could not be instantiated:
- android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache)

使用以下Stack:

java.lang.NullPointerException
    at android.support.v7.app.WindowDecorActionBar.getDecorToolbar(WindowDecorActionBar.java:240)
    at android.support.v7.app.WindowDecorActionBar.init(WindowDecorActionBar.java:197)
    at android.support.v7.app.WindowDecorActionBar.<init>(WindowDecorActionBar.java:189)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
    at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
    at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:178)
    at com.android.layoutlib.bridge.bars.AppCompatActionBar.<init>(AppCompatActionBar.java:89)
    at com.android.layoutlib.bridge.impl.Layout.createActionBar(Layout.java:237)
    at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:151)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:300)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:534)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:962)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:534)
    at com.android.tools.idea.rendering.RenderTask.lambda$inflate$40(RenderTask.java:660)
    at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:380)
    at com.android.tools.idea.rendering.RenderTask.inflate(RenderTask.java:660)
    at com.android.tools.idea.uibuilder.model.NlModel.inflate(NlModel.java:321)
    at com.android.tools.idea.uibuilder.model.NlModel.render(NlModel.java:378)
    at com.android.tools.idea.uibuilder.editor.NlPreviewForm$Pending.<init>(NlPreviewForm.java:234)
    at com.android.tools.idea.uibuilder.editor.NlPreviewForm.setFile(NlPreviewForm.java:293)
    at com.android.tools.idea.uibuilder.editor.NlPreviewManager$3.run(NlPreviewManager.java:290)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
    at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:267)
    at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:2405)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:279)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:378)
    at com.intellij.util.Alarm$Request.run(Alarm.java:398)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:227)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:857)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:658)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

我该怎么办?

1 个答案:

答案 0 :(得分:2)

单击错误消息中的清除缓存链接有时可以解决错误,关闭和重新打开项目也是如此。在The following classes could not be found: android.support.v7.internal.app.WindowDecorActionBar

中建议了另一种解决方案

可以找到“渲染问题”消息的进一步解决方案here