android - Android SharedPreferences 类使用错误的注解引用
问题描述
我更新了旧 Android 项目的build.gradle文件以使用新的androidx实现引用而不是旧的编译引用。在整个应用程序中,我必须用新的androidx.annotation.Nullable替换所有导入的android.support.annotation.Nullable。这似乎适用于应用程序自己的自定义代码库。
但是,该应用还有一个SharedPreferences类,它使用android.content.SharedPreferences类。后一个一直引用旧的android.annotation.Nullable现在给我一个“无法解析符号”错误。我在 build.gradle 文件中包含了以下实现,我不知道我是否遗漏了任何东西来保持它应该正常工作?
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "com.google.android.material:material:1.0.0-rc01"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'me.dm7.barcodescanner:zxing:1.9.13'
implementation 'me.dm7.barcodescanner:zbar:1.8.4'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.clans:fab:1.6.2'
implementation 'androidx.annotation:annotation:1.1.0'
解决方案
推荐阅读
- python - 如何将函数应用于数据框中一行中的下一个非空单元格
- node.js - 错误:nodejs nestjs 'npm run start' 我该如何解决这个问题?
- django - Django图像上传工作但不是通用文件
- java - 如何在Java中乘以保持特定精度的数字?
- python - 从由多个列表组成的字典中,从每个列表中选择一个元素
- python - 如何将参数作为参数传递给 Flask Framework 中的另一个方法
- sql - 在 Visual Studio 中使用 VB.NET 连接到本地 SQL 数据库的连接字符串问题
- grafana - Grafana - 如何将大仪表板 A 的一个图表导入/复制到仪表板 B?
- python - 使用 Python 的 Flask 内部服务器错误
- typescript - 转义模型中用作变量名的保留关键字