Android的kotlin和房间持久性库不建设
我试图使用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班
@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是否正常时,我的构建失败。
请检查日志,但我想房间很难转换你的
var users :ArrayList<String>