使用Kotlin Gradle DSL找不到会议室数据库的实现

时间:2019-09-15 21:47:02

标签: android gradle kotlin gradle-kotlin-dsl

我很难将Jetpack Room库添加到我的Gradle Kotlin DSL项目中。我已经从Room documentation修改了Room的实现步骤,并遇到以下错误:def powerSet(items): N = len(items) for i in range(2**N): combo = [] # <-- this is our subset for j in range(N): if (i >> j) % 2 == 1: combo.append(items[j]) yield combo # <-- here we yield it to caller subsets = list(powerSet(["apple", "banana", "pear"]))

以下是我到目前为止尝试过的所有内容。首先,是功能模块文件java.lang.RuntimeException: cannot find implementation for com.igorwojda.showcase.feature.news.cache.NewsDatabase. NewsDatabase_Impl does not exist中的依赖项:

feature_news.gradle.kts

import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions apply(plugin = "kotlin-kapt") // plugins{}, android{}, etc dependencies { implementation(project(ModuleDependency.APP)) addTestDependencies() api(LibraryDependency.ROOM_RUNTIME) kapt(LibraryDependency.ROOM_COMPILER) api(LibraryDependency.ROOM_RX_JAVA) } 的引用:

LibraryDependency

最后,数据库和实体非常简单

    // LibraryVersion.ROOM = "2.0.0"
    const val ROOM_RUNTIME = "androidx.room:room-runtime:${LibraryVersion.ROOM}"
    const val ROOM_COMPILER = "androidx.room:room-compiler:${LibraryVersion.ROOM}"
    const val ROOM_RX_JAVA = "android.arch.persistence.room:rxjava2:${LibraryVersion.ROOM}"

0 个答案:

没有答案