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
@Entity(tableName = "movies")
data class MovieKt(
@PrimaryKey
var id : Int,
var title: String,
var overview: String,
var poster_path: String,
var backdrop_path: String,
var release_date: String,
var vote_average: Double,
var isFavorite: Int
)
I can't build the app cause of the following error
Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type). Cannot find setter for field.
The examples I found are not far from this
Ideas on how to solve it?
static
is allowed in Kotlin but when it is compiled down, it looks like they replace it with another name causing the Room annotation processor to not be able to make the match with the field. - chRyNaN