CodePudding user response:
The error is quite clear, you must add @Entity
annotation to your User
class like this
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity
data class User(@PrimaryKey val id: Long, val name: String)
CodePudding user response:
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
@Entity
data class User(
@PrimaryKey(autoGenerate = true)
val id: Int,
val name: String?
)