android room Schema export directory is not provided to the annotation processor so we cannot export the schema.
解决:
android { compileSdk 31 defaultConfig { applicationId "com.xxxxx.xxxx" minSdk 24 targetSdk 31 versionCode 7 versionName "1.1.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" //指定room.schemaLocation生成的文件路径 javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] } } }
道法自然