Room: Database not created

后端 未结 1 855
眼角桃花
眼角桃花 2020-12-06 02:16

I try use room library from google architecture. I write few codes based on the BasicSample from google, but database not created (for my code). Logcat does not contains err

相关标签:
1条回答
  • 2020-12-06 02:53

    Under the covers, by default, Room uses SQLiteOpenHelper, much as you might use it directly.

    SQLiteOpenHelper does not create the database when you create the SQLiteOpenHelper instance. It will do so once you call getReadableDatabase() or getWriteableDatabase().

    From a Room standpoint, that means until you perform some concrete operation, such as invoking a @Dao method that hits the database, your database will not be created.

    0 讨论(0)
提交回复
热议问题