Home > Back-end >  How to browse android room database when using RequerySQLiteOpenHelperFactory
How to browse android room database when using RequerySQLiteOpenHelperFactory

Time:04-30

For my current Android application I am employing this version of Android Studio

Android Studio Dolphin | 2021.3.1 Canary 9
Build #AI-213.7172.25.2113.8473230, built on April 19, 2022
Runtime version: 11.0.13 0-b1751.21-8125866 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false

my local room database employs a HelperFactory from requery

api 'com.github.requery:sqlite-android:3.36.0'

this all works fine, apart from the fact Android Studio does not allow me to browse the database via the App Inspection -> Database Inspector

the only approach that I have found is to configure the HelperFactory to be set on release builds only.

Is there any method I can employ that allows Android Studio to open my on device room database when requery HelperFactory is set?

CodePudding user response:

Not as easy/convenient as App Inspection. You can use Device Explorer to locate the actual file(s) and copy them and inspect the database with an SQLite tool (DB Browser for SQLite, Navicat for SQlite, DBEaver, SQlite Studio).

Note that file(s) has been used as unless otherwise specified Room will use SQLite's WAL (write-ahead logging). If there are two files, the same name as the database file but suffixed with -wal and -shm and the -wal files is not empty, then part of the database will be in the -wal file. So in such a case it is important to copy the -wal and -shm file. If there is no -wal file or it is empty then the database has been fully checkpointed.

  • This is the way that would be used prior to Database Inspector/App Inspection came along.
  • Related