Room Persistence: Error:Entities and Pojos must have a usable public constructor

前端 未结 24 1809
长发绾君心
长发绾君心 2020-12-01 09:05

I\'m converting a project to Kotlin and I\'m trying to make my model (which is also my entity) a data class I intend to use Moshi to convert the JSON responses from the API<

24条回答
  •  不知归路
    2020-12-01 09:13

    I had the same issue. You can move the @Ignore fields to class body. For example :

    @Entity(tableName = "movies")
    data class MovieKt(
        @PrimaryKey
        var id : Int,
        var title: String
    ){
        //here
        @Ignore var overview: String
     }
    

提交回复
热议问题