2

I have a KMM app for iOS/Android where I am using SQLDelight (1.5.3). I would like to find the generated DB file (maybe .SQLite) and open it to see the content. (maybe using DB Browser in SQLite).

I am able to find the file through Xcode, but not sure how to do it using Android Studio for the Android app. Where is the file located? What is the format that is generated through the AndroidSqliteDriver.

I might have the wrong expectation, how can I visualize what I have in the DB?

Thanks.

Zsolt
  • 3,648
  • 3
  • 32
  • 47
  • I checked out their repo and it uses Android's `SupportSQLiteOpenHelper` to handle the file ([follow the `name` parameter in `AndroidSqliteDriver.kt`](https://github.com/cashapp/sqldelight/blob/f034a36f43ca74366cf59cf2790b98d33dab71d9/drivers/android-driver/src/main/java/app/cash/sqldelight/driver/android/AndroidSqliteDriver.kt)) - and it gets `SupportSQLiteOpenHelper` from `getApplicationContext()` which is also part of Android's platform lib - so the database files will be saved wherever the default DB location is on Android, I guess. – Dai Nov 21 '22 at 13:58
  • Thanks @Dai! I found a good explanation of various contexts here: https://stackoverflow.com/a/10641257/429763 So the emulator was here: `~/.android/avd/` and then based on the `applicationContext` debug details the files should have been at `/data/user/0/com.myapp/files`.. could not find it there though.. no hidden files either. – Zsolt Nov 21 '22 at 14:42

1 Answers1

1

It should be in /data/data/<Your-Application-Package-Name>/databases/<Your-DB-Name> on your device. For emulator the easiest way to go to device manager in your Android studio Android Studio screen

Evgeny K
  • 1,744
  • 3
  • 13
  • 19