Получите исключение при загрузке XML-файла Android Layout

По какой-то причине я получаю следующее исключение, когда загружаю XML-макет в eclipse.

Я не слишком уверен, что может быть причиной этого, поскольку я не верю, что внесли какие-либо новые изменения в файл. Также, когда я рисую макет с API 19 в eclipse, исключений нет. Однако, когда я обрабатываю API 21, я получаю следующее исключение? Что может вызвать такое исключение?

 java.lang.NullPointerException at android.view.ViewGroup_Delegate.drawShadow(ViewGroup_Delegate.java:74) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:61) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15017) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15017) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15017) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15223) at android.widget.FrameLayout.draw(FrameLayout.java:592) at android.widget.ScrollView.draw(ScrollView.java:1689) at android.view.View.draw(View.java:15022) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15017) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15017) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15117) at android.view.View.draw(View.java:15022) at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3404) at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:53) at android.view.ViewGroup.drawChild(ViewGroup.java:3404) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198) at android.view.View.draw(View.java:15117) at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:587) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:334) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:517) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1584) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1309) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1066) at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:686) at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360) at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:294) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:782) at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3110) at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1794) at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:283) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603) at org.eclipse.equinox.launcher.Main.run(Main.java:1465) at org.eclipse.equinox.launcher.Main.main(Main.java:1438) 

У меня была такая же проблема в Android Studio. В моем случае корневой макет был LinearLayout. Там у меня был вложенный RelativeLayout с высотой и шириной макета как match_parent и включен DrawerLayout, высота и ширина которых также были match_parent. У меня также была кнопка и TextView в RelativeLayout. Я думаю, что AndroidStudio не смог нарисовать Button и / или TextView из-за всех вложенных «match_parent».

Я попытался бы взглянуть на вложенные макеты. Если ваша проблема не является вложенными макетами, я бы попробовал изменить макет понемногу, чтобы увидеть, что среда IDE не может отобразить.