Andrew
Andrew

Reputation: 2157

Getting error android.view.InflateException when try to inflate custom view class android

I started to receive error:

 android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class me.markosullivan.swiperevealactionbuttons.SwipeRevealLayout
    Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class me.markosullivan.swiperevealactionbuttons.SwipeRevealLayout
    Caused by: java.lang.ClassNotFoundException: Didn't find class "me.markosullivan.swiperevealactionbuttons.SwipeRevealLayout" on path: DexPathList[[zip file "/data/app/de.jobnetzwerk.jobnet-1/base.apk", zip file "/data/app/de.jobnetzwerk

I'm trying to do smth like this solution. Here is my layout:

<?xml version="1.0" encoding="utf-8"?>
<me.markosullivan.swiperevealactionbuttons.SwipeRevealLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="90dp"
    app:dragFromEdge="right">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical|end"
            android:orientation="horizontal"
            android:paddingStart="20dp"
            android:paddingEnd="20dp">

            <ImageButton
                android:id="@+id/archive"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:text="Info"
                app:srcCompat="@drawable/ic_inbox" />

            <ImageButton
                android:id="@+id/delete"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:text="Edit"
                app:srcCompat="@drawable/ic_delete" />

        </LinearLayout>
    </FrameLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="15dp"
        android:layout_marginTop="4dp"
        android:layout_marginEnd="15dp"
        android:background="@drawable/message_list_item_bg"
        android:clickable="true"
        android:focusable="true">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:visibility="visible">


            <LinearLayout
                android:id="@+id/layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/title_of_item"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="5dp"

                    android:layout_weight="15"
                    android:ellipsize="end"
                    android:singleLine="true"
                    android:textColor="@color/black"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/date_of_item"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="5dp"
                    android:layout_marginEnd="5dp"
                    android:layout_weight="5"
                    android:gravity="end"
                    android:textColor="@color/black"
                    android:textSize="14sp" />

            </LinearLayout>


            <TextView
                android:id="@+id/job_location"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/layout"
                android:layout_marginStart="5dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="60dp"
                android:ellipsize="end"
                android:singleLine="true"
                android:textColor="@color/black" />


            <TextView
                android:id="@+id/jobStatus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/layout"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="5dp"
                android:textStyle="bold" />

            <com.lsjwzh.widget.materialloadingprogressbar.CircleProgressBar
                android:id="@+id/loader"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:layout_centerInParent="true"
                android:visibility="gone"
                app:mlpb_arrow_height="2dp"
                app:mlpb_arrow_width="7dp"
                app:mlpb_enable_circle_background="true"
                app:mlpb_progress_stoke_width="2.5dp"
                app:mlpb_show_arrow="false" />

            <TextView
                android:id="@+id/company_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/job_location"
                android:layout_marginStart="5dp"
                android:layout_marginTop="5dp"
                android:ellipsize="end" />

        </RelativeLayout>

    </FrameLayout>
</me.markosullivan.swiperevealactionbuttons.SwipeRevealLayout>

I have done also class which will provide me with viewgroup but I receive this error when I try to launch my app. Why does it happen and how I can solve this error? I tried to invalidate cashes and restart AS but it didn't help me.

Upvotes: 0

Views: 159

Answers (1)

Sdghasemi
Sdghasemi

Reputation: 5608

You need to use your own package name when using SwipeRevealLayout since you're implementing an example project which declares SwipeRevealLayout class with its own package me.markosullivan.swiperevealactionbuttons, so assuming you have declared your own implementation of SwipeRevealLayout.java in de.jobnetzwerk.jobnet package, your xml usage would be:

<?xml version="1.0" encoding="utf-8"?>
<de.jobnetzwerk.jobnet.SwipeRevealLayout
    ...

Upvotes: 2

Related Questions