gpt4 book ai didi

Android kotlin 和 Room Persistences 库未构建

转载 作者:行者123 更新时间:2023-11-30 00:30:58 25 4
gpt4 key购买 nike

我正在尝试将 Room 与 kotlin 一起使用,但没有任何效果,它会抛出以下内容:

Supported source version 'RELEASE_7' from annotation processor 'android.arch.lifecycle.LifecycleProcessor' less than -source '1.8'

Supported source version 'RELEASE_7' from annotation processor 'android.arch.persistence.room.RoomProcessor' less than - source '1.8'

The following options were not recognized by any processor: '[kapt.kotlin.generated]'

在我的 Build.Gradle 类中,我有以下内容(乱序但所有重要信息都在这里)

//project build.gradle
ext {
versions = [
support: '25.3.1',
dagger : '2.11',
arch_comp : '1.0.0-alpha1'
]
}
//app build.gradle

apply plugin: 'kotlin-kapt'


compile "android.arch.lifecycle:runtime:$rootProject.versions.arch_comp"
compile "android.arch.lifecycle:extensions:$rootProject.versions.arch_comp"
kapt "android.arch.lifecycle:compiler:$rootProject.versions.arch_comp"

compile "android.arch.persistence.room:runtime:$rootProject.versions.arch_comp"
compile "android.arch.persistence.room:rxjava2:$rootProject.versions.arch_comp"
kapt "android.arch.persistence.room:compiler:$rootProject.versions.arch_comp"

我的模块类

@Entity(tableName = "groups")
data class Group(@ColumnInfo(name = "group_name")
var groupName: String = "",
@ColumnInfo(name = "users")
var users :ArrayList<String> = ArrayList<String>()) {

@ColumnInfo(name = "id")
@PrimaryKey(autoGenerate = true)
var id: Long = 0

}

我的道课

@Dao
interface GroupDao {
@Query("SELECT * FROM groups")
fun getAll() : LiveData<ArrayList<Group>>

@Query("SELECT * FROM groups WHERE group_name = :p0")
fun getGroupByName(groupName: String) : Group

//I also did this but with no succsess instade of the above
@Query("SELECT * FROM groups WHERE group_name = :arg0")
fun getGroupByName(groupName: String) : Group
}

我是否遗漏了什么或做错了什么?

最佳答案

有同样的问题,并认为警告是问题所在。

在事件日志中向上滚动一点后,我看到当 Room 检查我的 SQL 是否正常时我的构建失败了。

请检查日志,但我想 Room 很难转换您的

var users :ArrayList<String>

关于Android kotlin 和 Room Persistences 库未构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44377364/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com