You may come across this exception if you are using PreferenceActivity/PreferenceFragment, and have been messing around with custom list separator styles.
The exception looks like this:
05-03 15:35:10.013 7029-7029/com.app.package.name W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb0cb3b20)
05-03 15:35:10.023 7029-7029/com.app.package.name E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.app.package.name, PID: 7029
java.lang.RuntimeException: Binary XML file line #18: You must supply a layout_width attribute.
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:492)
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5948)
at android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:5901)
at android.widget.AbsListView$LayoutParams.<init>(AbsListView.java:6420)
at android.widget.AbsListView.generateLayoutParams(AbsListView.java:6068)
at android.widget.AbsListView.generateLayoutParams(AbsListView.java:95)
at android.view.LayoutInflater.inflate(LayoutInflater.java:480)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.preference.Preference.onCreateView(Preference.java:483)
at android.preference.Preference.getView(Preference.java:460)
at
.........
I got this error when switching my styles over to the new AppCompat v22.1 library, to get rid of old theme files and simplify my theme.
It is complaining about the custom listSeparatorTextViewStyle
not having a specified layout_width
. You can add that to your custom listSeparatorTextViewStyle
:
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
What fixed the error for me, was just removing my custom listSeparatorTextViewStyle
in my theme file, as I didn't need it anymore.