Kotlin的房间数据库有什么问题?

我有一个数据类

@Entity(tableName = "type") data class Type( @PrimaryKey(autoGenerate = true) var id: Int = 0, var type: Int = 0 ) 

编译项目时收到消息

错误:由于多个构造函数是合适的,因此无法选择构造函数。

但是,如果我改变数据类

 @Entity(tableName = "type") data class Type( @PrimaryKey(autoGenerate = true) var id: Int = 0, var type: String = "" ) 

或者java类

 @Entity(tableName = "type") public class Type { @PrimaryKey(autoGenerate = true) private int id; private int type; // getters and setters } 

它工作正常。 是Kotlin错误还是别的?

我不知道这是为什么发生,但如果你使用ID? = 0解决了这个问题,至少在我做的测试中。

 Android Studio Beta 7 ext.support_version = '26 .1.0 ' ext.kotlin_version = '1.1.51' ext.anko_version = '0.10.1' ext.archroom_version = '1.0.0-alpha9-1' @Entity(tableName = "type") data class Type( @PrimaryKey(autoGenerate = true) var id: Int? = 0, var type: Int = 0 )