epoxy: Unable to use with DataBindings and AndroidX when not using 3.0.0-rc1

Hi I tried it with a simple DataBinding as a Model but building gives me:

e: error: Epoxy Processor Exception: Caused by TypeCastException: null cannot be cast to non-null type javax.lang.model.element.TypeElement Stacktrace: com.airbnb.epoxy.DataBindingModelInfo.<init>(DataBindingModelInfo.kt:27) com.airbnb.epoxy.DataBindingModelInfo.<init>(DataBindingModelInfo.kt:16) com.airbnb.epoxy.DataBindingProcessor.process(DataBindingProcessor.kt:33) com.airbnb.epoxy.EpoxyProcessor.processRound(EpoxyProcessor.java:189) com.airbnb.epoxy.EpoxyProcessor.process(EpoxyProcessor.java:165)

I do use Kotlin and AndroidX.

My Model XML looks like this:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
    <data>
        <variable
            name="displayName"
            type="String" />
        <variable
            name="lastMessage"
            type="String" />
    </data>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/selectableItemBackground">

        <de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/roomImage"
            android:layout_width="@dimen/dialog_avatar_width"
            android:layout_height="@dimen/dialog_avatar_height"
            android:layout_margin="16dp"/>

        <TextView
            android:id="@+id/displayNameID"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginEnd="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginTop="19dp"
            android:layout_toEndOf="@id/roomImage"
            android:layout_toLeftOf="@id/dialogDate"
            android:layout_toRightOf="@id/roomImage"
            android:layout_toStartOf="@id/dialogDate"
            android:ellipsize="end"
            android:fontFamily="@string/font_fontFamily_medium"
            android:includeFontPadding="false"
            android:maxLines="1"
            android:text="@{displayName}"/>

        <TextView
            android:id="@id/dialogDate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_marginEnd="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginTop="16dp"
            android:ellipsize="end"
            android:maxLines="1"/>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/displayNameID"
            android:layout_marginEnd="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginTop="7dp"
            android:layout_toEndOf="@id/roomImage"
            android:layout_toLeftOf="@+id/dialogUnreadBubble"
            android:layout_toRightOf="@id/roomImage"
            android:layout_toStartOf="@+id/dialogUnreadBubble">

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@id/dialogLastMessageUserAvatar"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginEnd="7dp"
                android:layout_marginRight="7dp"/>


            <TextView
                android:id="@+id/lastMessageID"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_toEndOf="@id/dialogLastMessageUserAvatar"
                android:layout_toRightOf="@id/dialogLastMessageUserAvatar"
                android:ellipsize="end"
                android:gravity="top"
                android:maxLines="1"
                android:text="@{lastMessage}"/>

        </RelativeLayout>

        <TextView
            android:id="@id/dialogUnreadBubble"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_below="@id/dialogDate"
            android:layout_marginEnd="24dp"
            android:layout_marginRight="24dp"
            android:layout_marginTop="10dp"
            android:background="@drawable/bubble_circle"
            android:ellipsize="end"
            android:fontFamily="@string/font_fontFamily_medium"
            android:gravity="center"
            android:lines="1"/>

        <FrameLayout
            android:id="@id/dialogDividerContainer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginTop="16dp">

            <View
                android:id="@id/dialogDivider"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/dialog_divider"/>

        </FrameLayout>

    </RelativeLayout>
</layout>

My package-info.java looks like this:

@EpoxyDataBindingLayouts({R.layout.room_element})
package blog.nordgedanken.simplematrix.roomView.recyclerView;

import com.airbnb.epoxy.EpoxyDataBindingLayouts;
import blog.nordgedanken.simplematrix.R;

I do use 3.0.0-rc1 with kapt as I use Kotlin

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (1 by maintainers)

Most upvoted comments

@markusressel in the end it was a combination of having clashing id namings and variables together with inconsistent epoxy versions. One of them was using an older version 😕

3.0.0 is finally out with androidx and all latest epoxy updates

Did you follow the instructions here: https://github.com/airbnb/epoxy/wiki/Data-Binding-Support

and added

implementation "com.airbnb.android:epoxy-databinding:$epoxyVersion"

to your build.gradle?

EDIT: Ah sorry, had an old version of this thread opened in browser and didn’t know you already closed it.