使用 Room 版本
如何使用
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
的实现引起了这些警告,根据生成的 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>
如何使用
lint.xml
来压制在build/generated/source
目录下出现的废弃警告,或者是否有更新/稳定版本的RoomDatabase
可以使用(而且不会导致这些警告出现)?