I'm trying to save the data class i got from json to room database and suddenly get errors like this while building the app.
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).
NewsResponse model object
data class NewsResponse(
val copyright: String,
val response: Response,
val status: String
)
Response object
data class Response(
val docs: List<Docs>
)
Docs object(this is the data class i want to save)
@Entity(
tableName = "docs"
)
data class Docs(
@PrimaryKey(autoGenerate = true)
var id: Int? = null,
val _id: String,
val `abstract`: String,
@Embedded
val byline: Byline,
val document_type: String,
@Embedded
val multimedia: Multimedia,
@Embedded
val headline: Headline,
val lead_paragraph: String,
val news_desk: String,
val pub_date: String,
val section_name: String,
val snippet: String,
val source: String,
val subsection_name: String,
val type_of_material: String,
val uri: String,
val web_url: String,
val word_count: Int
)
Byline object
@Entity
data class Byline(
val original: String
)
Multimedia object
@Entity
data class Multimedia(
val url: String
)
Headline object
@Entity
data class Headline(
val main: String
)
Any ideas how to solve this?