When I double click to open an android layout *.xml file in android studio i get an AssertionError: null in Event Log from Android studio and the layout editor doesn't open.
This doesn't happen in every project, and started to happen in projects there were already working fine, here the log error
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)
Now I can't edit/review layout files in Android studio, does anybody knows how to fix this problem?
To make room for the Layout Editor, hide the Project window. To do so, select View > Tool Windows > Project, or just click Project on the left side of the Android Studio screen. If your editor shows the XML source, click the Design tab at the top right of the window.
Convert a view or layout Click the Design button in the top-right corner of the editor window. In the Component Tree, right-click the view or layout, and then click Convert view.... In the dialog that appears, choose the new type of view or layout, and then click Apply.
Layout files are stored in "res-> layout" in the Android application. When we open the resource of the application we find the layout files of the Android application. We can create layouts in the XML file or in the Java file programmatically.
Android Layout Editor is the workplace in Android Studio, in which we do the design part of an android app by just dragging UI elements into the editor instead of writing XML code for it. Android Studio Layout Editor enables us to build layouts by dragging components onto the screen or editing an XML layout file.
Just delete this line from your activity:
tools:showIn="@layout/activity_splash"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With