致命异常:android.view.InflateException:二进制XML文件行#17:错误膨胀类android.support.v7.internal.view.menu.ExpandedMenuView

时间:2016-10-09 05:35:48

标签: android xml layout-inflater

我遇到错误,问题是我在错误消息和堆栈跟踪中看不到任何熟悉的名称或我的类。另一个困难是我仍然无法在我的设备上重现此崩溃,所以我不知道可能导致它的动作。

这是完整的堆栈跟踪:

Fatal Exception: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.v7.internal.view.menu.ExpandedMenuView
   at android.view.LayoutInflater.createView(LayoutInflater.java:613)
   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
   at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
   at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
   at android.support.v7.internal.view.menu.ListMenuPresenter.getMenuView(ListMenuPresenter.java:102)
   at android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState.getListMenuView(AppCompatDelegateImplV7.java:1908)
   at android.support.v7.app.AppCompatDelegateImplV7.initializePanelContent(AppCompatDelegateImplV7.java:1203)
   at android.support.v7.app.AppCompatDelegateImplV7.openPanel(AppCompatDelegateImplV7.java:1045)
   at android.support.v7.app.AppCompatDelegateImplV7.onKeyUpPanel(AppCompatDelegateImplV7.java:1410)
   at android.support.v7.app.AppCompatDelegateImplV7.onKeyUp(AppCompatDelegateImplV7.java:877)
   at android.support.v7.app.AppCompatDelegateImplV7.dispatchKeyEvent(AppCompatDelegateImplV7.java:871)
   at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:226)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1876)
   at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:4196)
   at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:4139)
   at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3199)
   at android.os.Handler.dispatchMessage(Handler.java:107)
   at android.os.Looper.loop(Looper.java:194)
   at android.app.ActivityThread.main(ActivityThread.java:5427)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:525)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
   at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Constructor.constructNative(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
       at android.view.LayoutInflater.createView(LayoutInflater.java:587)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
       at android.support.v7.internal.view.menu.ListMenuPresenter.getMenuView(ListMenuPresenter.java:102)
       at android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState.getListMenuView(AppCompatDelegateImplV7.java:1908)
       at android.support.v7.app.AppCompatDelegateImplV7.initializePanelContent(AppCompatDelegateImplV7.java:1203)
       at android.support.v7.app.AppCompatDelegateImplV7.openPanel(AppCompatDelegateImplV7.java:1045)
       at android.support.v7.app.AppCompatDelegateImplV7.onKeyUpPanel(AppCompatDelegateImplV7.java:1410)
       at android.support.v7.app.AppCompatDelegateImplV7.onKeyUp(AppCompatDelegateImplV7.java:877)
       at android.support.v7.app.AppCompatDelegateImplV7.dispatchKeyEvent(AppCompatDelegateImplV7.java:871)
       at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:226)
       at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1876)
       at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:4196)
       at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:4139)
       at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3199)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:194)
       at android.app.ActivityThread.main(ActivityThread.java:5427)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01012b a=4}
       at android.content.res.Resources.loadDrawable(Resources.java:2343)
       at android.content.res.TypedArray.getDrawable(TypedArray.java:604)
       at android.widget.AbsListView.<init>(AbsListView.java:810)
       at android.widget.ListView.<init>(ListView.java:147)
       at android.widget.ListView.<init>(ListView.java:143)
       at android.support.v7.internal.view.menu.ExpandedMenuView.<init>(ExpandedMenuView.java:54)
       at android.support.v7.internal.view.menu.ExpandedMenuView.<init>(ExpandedMenuView.java:50)
       at java.lang.reflect.Constructor.constructNative(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
       at android.view.LayoutInflater.createView(LayoutInflater.java:587)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
       at android.support.v7.internal.view.menu.ListMenuPresenter.getMenuView(ListMenuPresenter.java:102)
       at android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState.getListMenuView(AppCompatDelegateImplV7.java:1908)
       at android.support.v7.app.AppCompatDelegateImplV7.initializePanelContent(AppCompatDelegateImplV7.java:1203)
       at android.support.v7.app.AppCompatDelegateImplV7.openPanel(AppCompatDelegateImplV7.java:1045)
       at android.support.v7.app.AppCompatDelegateImplV7.onKeyUpPanel(AppCompatDelegateImplV7.java:1410)
       at android.support.v7.app.AppCompatDelegateImplV7.onKeyUp(AppCompatDelegateImplV7.java:877)
       at android.support.v7.app.AppCompatDelegateImplV7.dispatchKeyEvent(AppCompatDelegateImplV7.java:871)
       at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:226)
       at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1876)
       at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:4196)
       at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:4139)
       at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3199)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:194)
       at android.app.ActivityThread.main(ActivityThread.java:5427)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
       at dalvik.system.NativeStart.main(NativeStart.java)

1 个答案:

答案 0 :(得分:0)

您在xml中使用了错误的资源。您可能正在尝试将颜色资源用作可绘制的(即@color/而不是@drawable/。 如果您无法自行复制,可以重新检查xml并将其替换为可绘制的颜色。 此外,可能是因为您将drawable放在错误的文件夹中(即drawable-v21并尝试在API 19上运行应用程序) 因此,请重新检查您的xml。