如何抑制生成的源中的 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"

RoomDatabase@Dao实现会导致以下警告,每个生成的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"

最新更新