I'm seeing the following exception:
04-06 13:35:58.498 4219 4219 E AndroidRuntime: android.view.InflateException: Binary XML file line #17: Failed to resolve attribute at index 6: TypedValue{t=0x3/d=0x46 "res/color/abc_secondary_text_material_dark.xml" a=2 r=0x7f0e00e5}
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.support.v7.internal.view.menu.MenuPopupHelper$MenuAdapter.getView(MenuPopupHelper.java:374)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.support.v7.internal.view.menu.MenuPopupHelper.measureContentWidth(MenuPopupHelper.java:223)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.support.v7.internal.view.menu.MenuPopupHelper.tryShow(MenuPopupHelper.java:157)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.support.v7.widget.ActionMenuPresenter$OpenOverflowRunnable.run(ActionMenuPresenter.java:781)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x3/d=0x46 "res/color/abc_secondary_text_material_dark.xml" a=2 r=0x7f0e00e5}
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:705)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:6890)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:7071)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.widget.FrameLayout$LayoutParams.<init>(FrameLayout.java:446)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:386)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:385)
04-06 13:35:58.498 4219 4219 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:502)
This has happened twice now when I clicked the menu button in my Toolbar. Unfortunately, it seems to be quite unpredictable and happened twice out of a lot of attempts. My menu looks like this:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_action_show_project_startup"
android:title="@string/menu_action_project_intro"
android:orderInCategory="300"
app:showAsAction="never"/>
<item android:id="@+id/menu_action_report_issue"
android:title="@string/menu_action_report_issue"
android:orderInCategory="300"
app:showAsAction="never"/>
<item android:id="@+id/menu_action_toggle_mobile_data"
android:checkable="true"
android:checked="true"
android:title="@string/menu_action_toggle_mobile_data"
android:orderInCategory="500"
app:showAsAction="never"/>
<item android:id="@+id/menu_action_logout"
android:title="@string/menu_action_logout"
android:orderInCategory="600"
app:showAsAction="never"/>
</menu>
I had a look at a similar question - Android XML: RuntimeException: Failed to resolve attribute at index 6 - but my problem doesn't seem to originate from the FAB button and I am using AppCompat in my app.
Based on the above solution from TaoBit, I realized that the issue was with my theme was not acceptable in Marshmallow. So I replaced
<style name="Dark.Overlay" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">?attr/colorPrimary</item>
</style>
with this and it all worked. Thanks TaoBit for the hint. You saved 2 days worth of work and a lot of headache. I am loving SO by the day.
<style name="MyToolbar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:background">#FF0000</item>
<item name="android:textColorPrimary">#FFFFFF</item>
</style>
I think this is the bug report from Google, make sure you use the correct theme
https://code.google.com/p/android/issues/detail?id=152141
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