Room Persistence: Entities and Pojos must have a usable public constructor
Kotlin :
@Entity(tableName = "t_article_tabs")
data class WxArticleTabsEntity(
@ColumnInfo(name = "tabId") @PrimaryKey @SerializedName("id") val id: Int?,
@ColumnInfo(name = "tabName") @SerializedName("name") val name: String?,
...
@Ignore @SerializedName("children") val children: List<Any>?,
)
Change to :
@Entity(tableName = "t_article_tabs")
data class WxArticleTabsEntity(
@ColumnInfo(name = "tabId") @PrimaryKey @SerializedName("id") val id: Int?,
@ColumnInfo(name = "tabName") @SerializedName("name") val name: String?,
...
){
@Ignore @SerializedName("children") val children: List<Any>? = null
}
Please change names of the parameters such that it matches entity attributes.
public User(int userId, String userName, String userGender, int userAge, int userWeight, int userHeight, String workoutPlan) {
this.userId = userId;
this.userName = userName;
this.userGender = userGender;
this.userAge = userAge;
this.userWeight = userWeight;
this.userHeight = userHeight;
this.workoutPlan = workoutPlan;
} ...
For persistance, it uses JavaBeans conventions in Room. For more information: https://developer.android.com/training/data-storage/room/defining-data#java