flutter sqlite database storage location
I found the solution that works on Android. It is possible to extract the database file by using adb.
- Connect the phone via USB
- use the adb shell
- type
run-as *mypackage*.*app-name*
- you are in the
/data/data/*mypackage*.*app-name*
folder - cd into the databases folder
- copy the database file (i.e.
cp doggie_database.db /storage/self/primary/Documents
)
Use these 2 articles as reference:
https://denniskubes.com/2012/09/25/read-android-data-folder-without-rooting/
https://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html
Ole
Updated on December 25, 2022Comments
-
Ole over 1 year
I want to have an SQLite db in my flutter app, so i followed this flutter cookbook: https://flutter.dev/docs/cookbook/persistence/sqlite
I open the database with the following path:
join(await getDatabasesPath(), 'doggie_database.db')
exactly like the tutorial. I ran the app on my Android phone (not emulator).Now i want to inspect the database file on my PC, but i cannot find the file on my phone.
I debugged the above statement and it resolves to
/data/user/0/*mypackage*.*app-name*/databases/doggie_database.db
, but i can't find the folder/data
(onlyAndroid/data
) or the file in my file manager neither on my phone nor on my pc.Where is the file and how can i extract it from my phone?
-
Ole over 2 yearscp now doesn't seem to work any longer. did it using this answer now: stackoverflow.com/a/51780059/12949885