class 文件 android.support.v7.widget.RecyclerView$ViewHolder

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

我已经更新了我的应用程序以使用 androidx,从那以后我收到了这个错误:

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

这是我的模块 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'

}

我已经删除了 all reference to android.support.v7.widget.RecyclerView。我有另一个使用相同依赖项的应用程序,一切正常。

Andapter Studio 在以下行中抱怨:

public class MyAdapter extends RealmRecyclerViewAdapter<MyModel, MyViewHolder> {

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

更新 io.realm:android-adapters 依赖项:

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