According to google instructions in https://developer.android.com/training/data-storage/room I have added the following code to define a DAO in onCreate fun:
@Dao
interface UserDao {
@Query("SELECT * FROM user")
fun getAll(): List<User>
@Query("SELECT * FROM user WHERE uid IN (:userIds)")
fun loadAllByIds(userIds: IntArray): List<User>
@Query("SELECT * FROM user WHERE first_name LIKE :first AND " +
"last_name LIKE :last LIMIT 1")
fun findByName(first: String, last: String): User
@Insert
fun insertAll(vararg users: User)
@Delete
fun delete(user: User)
}
but I have 'UserDao' is an interface so it cannot be local. Error!
When I removed it from the onCreate function body, it was fixed.