I recently ran into an exception when trying to create a custom class that extends AndroidX's AppCompatImageView.
android.view.InflateException: Binary XML file line #9 in {package}:layout/all_message_row: Binary XML file line // #9 in {package}:layout/all_message_row: Error inflating class {package}.ui.view.DotImageView
I use View Binding in this project and it happens whenever you inflate your View, like:
AllMessageRowBinding.inflate(layoutInflater, parent, false)
Here's the class declaration:
class DotImageView(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
: androidx.appcompat.widget.AppCompatImageView(context, attrs, defStyleAttr) {
// rest of the class logic here
}