【问题标题】:class file for android.support.v7.widget.RecyclerView$ViewHolderandroid.support.v7.widget.RecyclerView$ViewHolder 的类文件
【发布时间】:2021-04-05 07:25:48
【问题描述】:

我已经更新了我的应用程序以使用 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

【问题讨论】:

    标签: android android-recyclerview realm


    【解决方案1】:

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

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

    【讨论】:

    • 你拯救了我的一天@Gabrielle Mariotti。非常感谢
    • 嗨@DeKekem,如果这个或任何答案解决了您的问题,请点击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-18
    • 1970-01-01
    • 2017-02-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-25
    • 1970-01-01
    相关资源
    最近更新 更多