ListItemView icon indicating copy to clipboard operation
ListItemView copied to clipboard

Binary XML file line #0: Error inflating class com.lucasurbas.listitemview.ListItemView

Open iman2420 opened this issue 7 years ago • 4 comments

This is my layout item :

 `<?xml version="1.0" encoding="utf-8"?>
  <com.lucasurbas.listitemview.ListItemView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/car_list_item_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:liv_displayMode="icon"
    app:liv_icon="@drawable/ic_launcher_foreground"
    app:liv_menu="@menu/car_list_single_action_menu"
    app:liv_subtitle="@string/car_list_subtitle"
    app:liv_title="@string/car_list_title"/>`

but i got InflateException:

 `android.view.InflateException: Binary XML file line #0: Error inflating class com.lucasurbas.listitemview.ListItemView

`

iman2420 avatar Nov 22 '17 19:11 iman2420

Is there further information in the stacktrace?

passsy avatar Nov 22 '17 19:11 passsy

I'm also having this problem:

compileSdkVersion 26 minSdkVersion 21 targetSdkVersion 26

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    tools:context="pt.eduardopinheiro.clocktouch.SettingActivity">


    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="160dp">

        <com.lucasurbas.listitemview.ListItemView
            android:id="@+id/list_item_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            app:liv_title="@string/admin_title"
            app:liv_subtitle="@string/admin_subtitle"
            app:liv_icon="@drawable/ic_settings_black_24dp"
            app:liv_menu="@menu/menu_admin"
            app:liv_multiline="false"
            app:liv_displayMode="icon"/>

    </FrameLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#bbbbbb" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:animateLayoutChanges="true"
            android:orientation="vertical">

            <com.lucasurbas.listitemview.ListItemView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:liv_subtitle="@string/manage_school_classes" />

            <com.lucasurbas.listitemview.ListItemView
                android:id="@+id/attr_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:liv_title="@string/manage_students" />

        </LinearLayout>




    </ScrollView>


</RelativeLayout>

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/action_add_school_class"
        android:icon="@drawable/ic_add_circle_outline_black_24dp"
        android:title="@string/manage_school_classes"
        app:showAsAction="always" />

    <item
        android:id="@+id/action_info"
        android:icon="@drawable/ic_child_care_black_24dp"
        android:title="@string/manage_students"
        app:showAsAction="always" />

</menu>
FATAL EXCEPTION: main
Process: com.xxxx, PID: 20397
java.lang.RuntimeException: Unable to start activity ComponentInfo{pt.eduardopinheiro.clocktouch/pt.eduardopinheiro.clocktouch.SettingActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.lucasurbas.listitemview.ListItemView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2452)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
    at android.app.ActivityThread.access$900(ActivityThread.java:158)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5515)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:654)
 Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.lucasurbas.listitemview.ListItemView
    at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412)
    at android.app.Activity.setContentView(Activity.java:2275)
    at pt.eduardopinheiro.clocktouch.SettingActivity.onCreate(SettingActivity.java:18)
    at android.app.Activity.performCreate(Activity.java:6459)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 
    at android.app.ActivityThread.access$900(ActivityThread.java:158) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5515) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:654) 
 Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.lucasurbas.listitemview.ListItemView
    at android.view.LayoutInflater.createView(LayoutInflater.java:645)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
    at android.app.Activity.setContentView(Activity.java:2275) 
    at pt.eduardopinheiro.clocktouch.SettingActivity.onCreate(SettingActivity.java:18) 
    at android.app.Activity.performCreate(Activity.java:6459) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 
    at android.app.ActivityThread.access$900(ActivityThread.java:158) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5515) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:654) 
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at android.view.LayoutInflater.createView(LayoutInflater.java:619)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
    at android.app.Activity.setContentView(Activity.java:2275) 
    at pt.eduardopinheiro.clocktouch.SettingActivity.onCreate(SettingActivity.java:18) 
    at android.app.Activity.performCreate(Activity.java:6459) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 
    at android.app.ActivityThread.access$900(ActivityThread.java:158) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5515) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:654) 
 Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class <unknown>
    at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at com.lucasurbas.listitemview.util.view.MenuView.createActionView(MenuView.java:235)
    at com.lucasurbas.listitemview.util.view.MenuView.reset(MenuView.java:156)
    at com.lucasurbas.listitemview.util.view.MenuView.reset(MenuView.java:230)
    at com.lucasurbas.listitemview.ListItemView.inflateMenu(ListItemView.java:496)
    at com.lucasurbas.listitemview.ListItemView.setupView(ListItemView.java:257)
    at com.lucasurbas.listitemview.ListItemView.init(ListItemView.java:199)
    at com.lucasurbas.listitemview.ListItemView.<init>(ListItemView.java:171)
    at java.lang.reflect.Constructor.newInstance(Native Method) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
    at android.app.Activity.setContentView(Activity.java:2275) 
    at pt.eduardopinheiro.clocktouch.SettingActivity.onCreate(SettingActivity.java:18) 
    at android.app.Activity.performCreate(Activity.java:6459) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 
    at android.app.ActivityThread.access$900(ActivityThread.java:158) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5515) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:654) 
 Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class <unknown>
    at android.view.LayoutInflater.createView(LayoutInflater.java:645)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
	at android.view.LayoutInflater.infl

ejbp avatar Jan 07 '18 22:01 ejbp

I had the same problem but using an XML instead of a png worked for me.

sankhakarfa avatar Feb 20 '18 12:02 sankhakarfa

Thank you for raising the issue. I took a look at it today. Unfortunately, couldn't reproduce it. Tried on different sdk versions (19, 21, 26) without any luck. Also tried with a mix of vector and png drawables. If you could send me a link to small project on github which presents described crash, I would be able to verify it and make a fix. Thanks in advance.

lurbas avatar Feb 25 '18 05:02 lurbas