question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
MTRNordcommented, Oct 27, 2018

@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 😕

1reaction
elihartcommented, Nov 13, 2018

3.0.0 is finally out with androidx and all latest epoxy updates

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kotlin-android: unresolved reference databinding
Try use this configuration: In main build.gradle: buildscript { ext.kotlin_version = '<kotlin-version>' ext.android_plugin_version = '2.2.0-alpha4' ...
Read more >
Databinding - Android Developers
Bind UI components in your layouts to data sources in your app using a declarative format. Latest Update, Stable Release, Release Candidate ...
Read more >
NoesisGUI 3.0 Release Notes - Documentation
Fixed Absolute radial gradients not rendering on some android devices due to precision problems. Fixed Crash when using Binding in ...
Read more >
com.fasterxml.jackson.core » jackson-databind
Jackson Databind. General data-binding functionality for Jackson: ... #1 in JSON Libraries. Used By, 24,540 artifacts ... Oct 11, 2022. 2.14.0-rc1 · Central....
Read more >
Databinding is broken on non-base feature modules [63814741]
Sincerely hope google can fix it and let we use databinding in non-base feature modules. ... So I am using Android Studio 3.0.1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found