当前位置:网站首页>使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor

使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor

2022-07-05 05:13:00 菜鸟xiaowang

警告: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.
public abstract class MyRoomDatabase extends RoomDatabase {

未向批注处理器提供架构导出目录,因此无法导出架构。你可以提供room.schemaLocation注释处理器参数或将exportSchema设置为false

解决方法


1、在build gradle中添加(推荐)

javaCompileOptions {
    annotationProcessorOptions {
        arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
    }
}

2.exportSchema = false

原网站

版权声明
本文为[菜鸟xiaowang]所创,转载请带上原文链接,感谢
https://blog.csdn.net/xiaowang_lj/article/details/125602818