如何抑制生成源中的 Lint 警告?
How to suppress Lint warnings in generated sources?
房间版本 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
class:
[deprecation] mCallbacks in RoomDatabase has been deprecated
问题是,这些文件位于 mobile/build/generated/source/apt/debug
,而似乎只有 <ignore path="src/main/..."/>
相似的路径。到目前为止我已经尝试过的,以及绝对和相对路径和 **/
- 以及合格的 class 名称,有和没有通配符:
<?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
中抑制这些弃用警告 - 或者是否有 newer/stable 版本或 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"
房间版本 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
class:
[deprecation] mCallbacks in RoomDatabase has been deprecated
问题是,这些文件位于 mobile/build/generated/source/apt/debug
,而似乎只有 <ignore path="src/main/..."/>
相似的路径。到目前为止我已经尝试过的,以及绝对和相对路径和 **/
- 以及合格的 class 名称,有和没有通配符:
<?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
中抑制这些弃用警告 - 或者是否有 newer/stable 版本或 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"