requery / sqlite-android

Android SQLite support library
Apache License 2.0
1.06k stars 140 forks source link

RequerySQLiteOpenHelperFactory is preventing Android Studio App Inspector from accessing database #147

Closed lmj0011 closed 3 years ago

lmj0011 commented 3 years ago

I have requery added to my Room DB instance like so:

val db = Room.databaseBuilder(
   context.applicationContext,
   CourierLockerDatabase::class.java,
   "courier_locker_database"
 )
.openHelperFactory(RequerySQLiteOpenHelperFactory())
.build()

When I go to inspect the database in android studio via App Inspection, the database is closed..

Screenshot from 2021-05-04 00-36-44

If I remove the RequerySQLiteOpenHelperFactory, and rebuild app:

val db = Room.databaseBuilder(
   context.applicationContext,
   CourierLockerDatabase::class.java,
   "courier_locker_database"
 )
//.openHelperFactory(RequerySQLiteOpenHelperFactory())
.build()

The database is accessible like normal again. My guess is that requery is opening/closing the database instead of just keeping it open during the app's runtime....

If so, is there a way to change this behavior?

I'm using: 'com.github.requery:sqlite-android:3.35.4'

falcon4ever commented 3 years ago

https://developer.android.com/studio/inspect/database

Note: The Database Inspector only works with the SQLite library included in the Android operating system on API level 26 and higher. It doesn't work with other SQLite libraries that you bundle with your app.

I do wonder why though, in offline mode (after detaching the app and downloading the db) the Database Inspector is able to inspect the db and allows JSON1 commands as well

lmj0011 commented 3 years ago

@falcon4ever

I do wonder why though, in offline mode (after detaching the app and downloading the db) the Database Inspector is able to inspect the db and allows JSON1 commands as well

May be that Android Studio loads the json1 extension in its version of sqlite.

Anyway it doesn't appear to be anything the devs can do about this, so I'll close this issue.