Is there any easier way to see the contents of database created with Room Persistence Library in Android Studio?
Database Inspector Officially Support in Android Studio You have to choose your connected device, then need to choose package name that you want to inspect for database. In the left side, show the available tables and need to double click to see table details, and it will be show in the right side.
The Room persistence library provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite. In particular, Room provides the following benefits: Compile-time verification of SQL queries.
Room is a persistence library that's part of Android Jetpack. Room is an abstraction layer on top of a SQLite database. SQLite uses a specialized language (SQL) to perform database operations. Instead of using SQLite directly, Room simplifies the chores of setting up, configuring, and interacting with the database.
Open Device File Explorer via View > Tool Windows > Device File Explorer. Go to data > data > PACKAGE_NAME > database , where PACKAGE_NAME is the name of your package (it is com. Movie in the example above) Right click on the database and select Save As... . Save it anywhere you want on your PC.
In older Android Studio versions:
Emulator -> Android Studio -> Device File Explorer -> /data/data/{$packageId}/databases/ -> Save As -> https://sqlitebrowser.org/
In later Android Studio versions (3.5+):
View -> Tool Windows -> Device File Explorer -> /data/data/{$packageId}/databases/ -> Save As -> https://sqlitebrowser.org/
in android studio 3.1.*
in tool window bar click on "Device File explorer
" generally you can find this in bottom right corner of the screenn
open directory in data/data/your-application-package/databases
with new architecture 3 files is created in databases directory
your-database-name your-database-name-shm your-database-name-wal
you have to export all 3 in the same directory
then open first one file (that is with your-database-name only ) in any sqlite browser.
and now you can see all your data .......
your-database-name-shm your-database-name-wal
these two extra files are needed to open db file if you will open database file only, than you will not found any table in that file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With