我添加了apply plugin: 'kotlin-kapt'
以便能够使用Rooms annotation proccessor:
compile "android.arch.persistence.room:runtime:1.0.0"
kapt "android.arch.persistence.room:compiler:1.0.0"
然而,当我构建我的项目时,我得到:
Folder C:\Users\...\app\build\generated\source\kaptKotlin\debug
Folder C:\Users\...\app\build\generated\source\kaptKotlin\release
3rd-party Gradle plug-ins may be the cause
如果我摆脱kapt
而只是使用annotationProcessor
。该应用程序崩溃说:
java.lang.RuntimeException:无法找到实现 com.example..data.database.Appdatabase。 Appdatabase_Impl不存在
有关如何使用房间的任何想法
答案 0 :(得分:1)
我面临类似的问题。
转到:
运行->编辑配置->常规
在底部,有一个名为
的窗口启动前:Gradle-Aware,活动工具窗口
删除
即时应用设置
并保持Gradle意识的制作
答案 1 :(得分:0)
我删除两个文件夹app \ build \ Generated \ source \ kaptKotlin \ debug和app \ build \ Generated \ source \ kaptKotlin \ release(“ debug”和“ release”)并添加 在gradle中:
kapt {
mapDiagnosticLocations = true
}
然后项目就同步了,没问题。