Android Room database file is empty

前端 未结 5 813
一生所求
一生所求 2020-12-13 06:38

Using room in android for database. When I tried to see the data in sqlviewer then no tables found in database file Myapp.db file is empty. Data/data/packageName/databases/M

5条回答
  •  一向
    一向 (楼主)
    2020-12-13 07:21

    Once check your Database class,

    @Database(entities = arrayOf(Test::class), version = 1, exportSchema = false)
    
    abstract class MyDatabase:RoomDatabase() {
           private var INSTANCE: MyDatabase? = null
           abstract fun testDao(): TestDao
    }
    

    Here, MyDatabase is my Database class, Test is the table name and TestDao is the Dao class.

提交回复
热议问题