Reputation: 1106
I'm working on room database and currently update my android studio and studio updated with androidx and then after i found this compile error, So please let me know what is that error ?
import androidx.room.Database;
@Database (entities = User.class,version = 1)
public abstract class MyDatabase {
public abstract MyDao myDao();
}
Upvotes: 2
Views: 2733
Reputation: 546
Here is a kotlin version if anybody needs it:
@Database(entities = [User::class], version = 1)
abstract class MyDatabase : RoomDatabase() {
abstract fun myDao(): MyDao?
}
Upvotes: 4
Reputation: 2966
@Database (entities = User.class,version = 1)
public abstract class MyDatabase extends RoomDatabase {
public abstract MyDao myDao();
}
As your error message suggested you should extend RoomDatabase
Upvotes: 8
Reputation: 197
Extend RoomDatabase
public abstract class MyDatabase extends RoomDatabase{
}
Upvotes: 1