der_Fidelis
der_Fidelis

Reputation: 1515

"The following classes could not be found" with custom Kotlin view in layout

I'm running into a problem including a custom Kotlin view in an XML layout file. Here's the code:

class CustomView: RelativeLayout {

    /**
     * Programmatic constructor
     */
    constructor(aVariable: Boolean, context: Context): super(context) { ... }

    /**
     * XML constructor
     */
    @JvmOverloads
    constructor(context: Context, attributeSet: AttributeSet? = null, defStyle: Int = 0): super(context, attributeSet, defStyle) { ... }

}

and the XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".MainActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.turingtechnologies.materialscrollbar.CustomView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

</RelativeLayout>

Then the layout previewer complains:

"Missing classes-

The following classes could not be found: com.turingtechnologies.materialscrollbar.CustomView (Fix Build Path, Edit XML, Create Class)"

Note: This is AS 3.0 beta 3

Upvotes: 2

Views: 1002

Answers (1)

der_Fidelis
der_Fidelis

Reputation: 1515

Confirmed bug https://issuetracker.google.com/issues/62255811. Fix should appear in the next release of Android Studio.

Upvotes: 1

Related Questions