3

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 (only Android/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?

0

2 Answers 2

2

I found the solution that works on Android. It is possible to extract the database file by using adb.

  1. Connect the phone via USB
  2. use the adb shell
  3. type run-as *mypackage*.*app-name*
  4. you are in the /data/data/*mypackage*.*app-name* folder
  5. cd into the databases folder
  6. 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

Sign up to request clarification or add additional context in comments.

1 Comment

cp now doesn't seem to work any longer. did it using this answer now: stackoverflow.com/a/51780059/12949885
-1

In the case of iOS simulator, you can easily find the sqlite database storage location with the following code.

getDatabasesPath().then( (value) => print(value) );

flutter: /Users/*** your name *** /Library/Developer/CoreSimulator/Devices/4769664D-2588-4E47-A29F-5CD9DB801595/data/Containers/Data/Application/3F53C2F3-687C-4E3D-8611-66A6D8BFC84B/Documents

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.