有房间版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/