android - 如何抑制生成源中的 Lint 警告?

标签 android android-room androidx deprecation-warning android-lint

有房间版2.1.0-alpha04 :

implementation "androidx.room:room-runtime:2.1.0-alpha04"
annotationProcessor "androidx.room:room-compiler:2.1.0-alpha04"
testImplementation "androidx.room:room-testing:2.1.0-alpha04"

@Dao RoomDatabase 的实现根据生成的 Dao_Impl 导致这些警告:

[deprecation] setTransactionSuccessful() in RoomDatabase has been deprecated
[deprecation] beginTransaction() in RoomDatabase has been deprecated
[deprecation] endTransaction() in RoomDatabase has been deprecated

还有这个 @Database类:

[deprecation] mCallbacks in RoomDatabase has been deprecated

问题是,这些文件位于 mobile/build/generated/source/apt/debug , 而只有路径相似 <ignore path="src/main/..."/>似乎捕获了。到目前为止我已经尝试过的,以及绝对和相对路径和 **/ - 以及合格的类名,带通配符和不带通配符:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="Deprecated" severity="informational">
        <ignore regexp="androidx.room.RoomDatabase" />
    </issue>

    <issue id="Deprecated">
        <ignore regexp="com.acme.database.dao.*Dao_Impl" />
    </issue>
</lint>

如何在 build/generated/source 中抑制这些弃用警告与 lint.xml - 或者是否有更新/稳定的版本或RoomDatabase ,哪个有效(并且不会导致这些警告)?

最佳答案

将 Room 更新到版本 2.2.0-alpha02 移除弃用警告:

annotationProcessor "androidx.room:room-compiler:2.2.6"
testImplementation "androidx.room:room-testing:2.2.6"
implementation "androidx.room:room-runtime:2.2.6"

关于android - 如何抑制生成源中的 Lint 警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57398292/

相关文章:

java - Android Room - 返回过去 30 天(1 个月) - java

Android WorkManager Worker 无法使用 Dagger Hilt `@WorkerInject` 注入(inject)

android - 了解正确的Android警报 "flow"

Android:bindService 不会连接到远程 (AIDL) 服务,我不知道为什么

android - 授予 android 应用程序连接到 "unverified server"的权限

android - 请求 READ_CONTACTS 权限 Android M 时出错

android - : Landroid/arch/core/executor/AppToolkitTaskExecutor 解析失败

java - 迁移房间数据库时无法添加索引

android - 无法解析 : com. android.support :appcompat-v7:28. 0.3

android - 在相对布局中向芯片组添加水平滚动