1

我試圖用間科特林並沒有什麼作品,它拋出如下:安卓科特林和房不放過庫建設不

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 
} 

我錯過了什麼或做錯了什麼?

+0

任何機會源版本設置爲1.8你。試試看看它是否解決了問題 –

+1

不,我不是我正在使用1.8,這就是爲什麼它很奇怪 –

+0

您發佈的Gradle輸出只包含警告,而不包含錯誤。請更確切地說明「無效」?也許相關的問題:https://youtrack.jetbrains.com/issue/KT-17959 –

回答

1

有同樣的問題,並認爲警告是問題。

在事件日誌中滾動一下之後,我發現當Room檢查SQL是否正常時,我的構建失敗。

請檢查日誌,但我猜房間有很難轉換你的

var users :ArrayList<String>