无法在Android Studio中编辑/查看布局文件

时间:2013-07-01 19:33:44

标签: android-studio

当我在android studio中双击打开android布局* .xml文件时,我在Android Studio的事件日志中得到一个AssertionError:null,并且布局编辑器无法打开。

这不会发生在每个项目中,并且开始在已经正常工作的项目中发生,这里是日志错误

null
java.lang.AssertionError
    at com.android.tools.idea.rendering.MultiResourceRepository.setChildren(MultiResourceRepository.java:47)
    at com.android.tools.idea.rendering.MultiResourceRepository.<init>(MultiResourceRepository.java:43)
    at com.android.tools.idea.rendering.ModuleResourceRepository.<init>(ModuleResourceRepository.java:57)
    at com.android.tools.idea.rendering.ModuleResourceRepository.create(ModuleResourceRepository.java:87)
    at com.android.tools.idea.rendering.ProjectResources.create(ProjectResources.java:174)
    at org.jetbrains.android.facet.AndroidFacet.getProjectResources(AndroidFacet.java:996)
    at com.android.tools.idea.rendering.ProjectResources.get(ProjectResources.java:163)
    at com.android.tools.idea.rendering.ProjectResources.get(ProjectResources.java:154)
    at com.android.tools.idea.rendering.ModuleSetResourceRepository.create(ModuleSetResourceRepository.java:43)
    at com.android.tools.idea.rendering.ProjectResources.create(ProjectResources.java:172)
    at org.jetbrains.android.facet.AndroidFacet.getProjectResources(AndroidFacet.java:991)
    at com.android.tools.idea.rendering.ProjectResources.get(ProjectResources.java:163)
    at com.android.tools.idea.rendering.ProjectResources.get(ProjectResources.java:154)
    at com.android.tools.idea.configurations.ConfigurationManager.create(ConfigurationManager.java:120)
    at com.android.tools.idea.configurations.ConfigurationManager.getConfiguration(ConfigurationManager.java:99)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowForm.setFile(AndroidLayoutPreviewToolWindowForm.java:234)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:322)
    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.UIUtil.invokeLaterIfNeeded(UIUtil.java:2003)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:266)
    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.Alarm$Request$1.run(Alarm.java:289)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:347)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:633)
    at java.awt.EventQueue$2.run(EventQueue.java:631)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:701)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:526)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:349)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

现在我无法在Android工作室编辑/查看布局文件,有人知道如何解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

Android Studio  问题124715

解决方案: 你可以通过编辑&#34; studio.exe.vmoptions&#34;此路径中的文件:Program Files \ Android \ Android Studio \ bin。删除说&#34; -ea&#34;。

的行

您可以参考this链接

答案 1 :(得分:0)

只需从您的活动中删除此行:

tools:showIn="@layout/activity_splash"