android - 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'
推荐阅读
- python - 为什么这些自定义函数在 Python 中打印不同的值?
- javascript - 将参数传递给 JSON 对象中的函数
- jquery - 通过ajax将带有图像和json的Formdata发送到服务器端
- css - 将图像大小调整为 CSS 网格,同时在悬停时进行图像替换
- javascript - 从 JavaScript 中的 2 个不同来源增加一个值
- tomcat - 如何让 Tomcat 接受端口 8443 上的 SSL 连接?
- javascript - 在末尾隐藏一个div
- reactjs - 测试对儿童进行操作的效用函数
- jquery - jQuery / 选择选项元素
- java - 我试图在 4 名玩家之间平均处理一副 52 张扑克牌,这意味着他们每人将有 13 张牌。每张只能发牌 4 张