I got this error when I tried to launch my app while using sqlite database.
I have 3 data classes in seperate files:
@Entity(tableName = "movies")
data class MovieNews(
@PrimaryKey(autoGenerate = true)
var id: Int? = null,
@SerializedName("movie_db")
@Embedded(prefix = "movies_")
val movies: List<Movies>? = null,
)
data class Movies(
val description: String? = null,
@Embedded(prefix = "actors_")
val actors: List<Actors>? = null,
)
data class Actors(
val name: String? = null
val age: Int? = null
)
When I launched the app I got the error:
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). - java.util.List
How can I fix this error?
Don't know if this is related to the problem, but I have this warning
w: [kapt] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC).
I also saw bunch of questions about this error, none of them solved my problem
UPDATE:
If I comment out the Embedded line, the app does compile.
I dug into stackoverflow questions and what I found that probably there is a problem with Embedded
and Lists.
@SerializedName("movie_db")
@Embedded(prefix = "movies_")
val movies: List<Movies>? = null,