我有以下问题:我将 Koin 用于 DI,将 Room 用于持久性。现在我的房间依赖项如下:
// Architecture Component - Room
implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
但是我得到了这里描述的错误: Android room persistent: AppDatabase_Impl does not exist
所以我把annotationProcessor改成了kapt。但是现在我从数据绑定类中自动生成了多个错误,而 annotationProcessor 不存在这些错误。例如:
app/build/generated/data_binding_base_class_source_out/debug/dataBindingGenBaseClassesDebug/out/databinding/FragmentBinding.java:26: error: cannot find symbol
protected FragmentBinding(DataBindingComponent _bindingComponent, View _root,
^
symbol: class DataBindingComponent
location: class FragmentBinding
Koin 模块定义:
val persistenceModule = module {
single {
Room.databaseBuilder(androidApplication(), Database::class.java, "database.db")
.build()
}
single { get<Database>().dao() }
}
这怎么可能发生?