Search code examples
androidandroid-recyclerviewrealm

class file for android.support.v7.widget.RecyclerView$ViewHolder


I have updated my app to use androidx and since then I am getting this error:

class file for android.support.v7.widget.RecyclerView$ViewHolder

Here is my module buidle.gradle:

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'io.realm:android-adapters:3.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
implementation 'com.google.android.gms:play-services-ads:19.8.0'
implementation 'com.prolificinteractive:material-calendarview:1.4.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}

I have remove all reference to android.support.v7.widget.RecyclerView. I have another app using the same dependencies and everything is working fine.

Andapter Studio is complaining on the following line:

public class MyAdapter extends RealmRecyclerViewAdapter<MyModel, MyViewHolder> {

with: Type parameter MyViewHolder is not with its bound. Should extend android.support.v7.widget.RecyclerView.ViewHolder


Solution

  • Update the io.realm:android-adapters dependency:

    implementation 'io.realm:android-adapters:4.0.0'