I\'m trying my hand at using Android Room and after following this tutorial I\'m getting the following error when i try to build the app:
Error:(23, 27) error: The
It helped me a lot to see the articles. I had this errorDatabase(entities = {Folder.class}, version = 1, exportSchema = false)
just add my other class @Database(entities = {Folder.class, Urls.class}, version = 1, exportSchema = false)
If you just added a new table, just update your Database class (That one class extending the RoomDatabase() class) and update the entities annotation
@Database(entities = [User::class, NewTableHere::class], version = 1)
abstract class AppDatabase : RoomDatabase() {
Wish it saves you time on searching for answer, happy coding.
my problem was with TABLE NAME
:|||
I wrote my table name In the wrong word :(((
In my case, the cause of the problem was using the wrong table name. The table name I chose for my model class was different from the class name. I erroneously used the class name while querying my Data-Access-Object interface.
@Query("SELECT * FROM tablename")
Check your table name to make sure they match with the table name annotated into the model class.
I hope this helps. Merry coding!
Another reason for this error could be the entity is not listed in the AppDatabase.java file:
@Database(entities = {XEntity.class, YEntity.class, ZEntity.class},
version = 1, exportSchema = true)
Make sure you have the latest db file in the databases folder, and if you export your schema, make sure your .json schema file under app\schemas is being properly updated.
Room names tables the same as their associated entities. In your DAO, TABLE_ITEMS
needs to be PermitItem
, because your entity is PermitItem
. Or, add the tableName
property to the @Entity
annotation, to tell Room some other name to use for the table.