Mac, Android Studio, Emulator, SQLite database - actually find directory?


Android Studio, Mac. Everything latest version. Say you do this...

SQLiteDatabase db;
db = yourAppContext.openOrCreateDatabase("db.sqlite3", Context.MODE_PRIVATE, null);


it's possible to exactly find the directory holding your actual SQLite3 database on the emulator as it runs:

enter image description here

Great stuff.

Next you can click the Pull button, and pull that file to say your desktop on the Mac. Awesome.


How do you actually find literally that folder ("databases" in the example), on your Mac?

i.e., using a normal shell terminal, I want to "cd" to there.

Where the heck is that folder, in the ordinary 'nix file structure of the host Mac computer?

Show source
| osx   | android-studio   | sqlite3   | android-emulator   | android-device-monitor   2017-01-06 03:01 2 Answers

Answers to Mac, Android Studio, Emulator, SQLite database - actually find directory? ( 2 )

  1. 2017-01-11 05:01

    adb (Android Debug Bridge) is needed to access an emulator device's filesystem via the command-line . If you don't already have it installed you can download it here.

    Once installed it's just a matter of using a few commands to view/access the files:

    1. Open
    2. Execute adb devices (this should list your current emulator devices).
    3. Connect to the emulator device with adb shell .
    4. Change directory cd to the folder where your app databases are.
    5. Type ls to see which database files are present.

    In Terminal it would look something like this:

    List the emulator devices:

    $ adb devices
    List of devices attached
    emulator-5554  device

    Connect to device with adb shell:

    $ adb -s emulator-5554 shell

    Change directory (cd) into it's SQLite3 database location (package name is usually com...):

    adb shell
    $ cd /data/data/<your app package name>/databases/

    List the files in the databases directory:

    adb shell
    $ ls

    That's really the basics of it! It's also possible to push/pull to copy files from the emulator (remote) to your (local) filesystem:

    adb pull /data/data/ /local/save/path

    More information:

  2. 2017-01-11 05:01

    or you can pull databases using this command

    adb pull /data/data/com.application/databases/ for example adb pull /data/data/com.zameen.propforce/databases/

    secondly that folder is not accessible unless your device is rooted or you are using emulator

    if your device is rooted. you get super user access by adb su command then you can go to this directory

Leave a reply to - Mac, Android Studio, Emulator, SQLite database - actually find directory?

◀ Go back