Where does Android emulator store SQLite database?
The filesystem of the emulator doesn't map to a directory on your hard drive. The emulator's disk image is stored as an image file, which you can manage through either Eclipse (look for the G1-looking icon in the toolbar), or through the emulator binary itself (run "emulator -help" for a description of options).
You're best off using adb from the command line to jack into a running emulator. If you can get the specific directory and filename, you can do an "adb pull" to get the database file off of the emulator and onto your regular hard drive.
Edit: Removed suggestion that this works for unrooted devices too - it only works for emulators, and devices where you are operating adb as root.
Accessing SQLite database in android emulator
There is an example on that link about "sqlite command in adb"
How access existing sqlite database on Android Emulator?
In Eclipse Go to Window > Open Persepective > Other > DDMS. Navigate to the DB like the image from the answer below, select the database then click on the floppydisk icon to pull the file from the device on the top right.
In the emulator, the location in DDMS should be /data/data/com.yourNamespace/databases in the File Explorer tab.
This is a pic of the DDMS perspective. In the File Explorer tab on the right, you would drill down to the databases folder. These are virtual folders, so you won't find them on your system. To examine the db, you would select the icon for Pull file from the device (sorry, it got cropped out in this screenshot) and open that file in SQLite.
How to find sqlite file on Android simulator?
In Android 3.1.1 At Right side corner you have a tab called Device File Explorer
In That go to data/data find your application package name in tha folder will be there name database there you will find sqlite file.
Mac, Android Studio, Emulator, SQLite database - actually find directory?
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:
- Open
Terminal.app
.- Execute
adb devices
(this should list your current emulator devices).- Connect to the emulator device with
adb shell
.- Change directory
cd
to the folder where your app databases are.- 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
db.sqlite3
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/com.yourpackagename.app/databases/db.sqlite3 /local/save/path
If Permission is denied run ADB in root mode:
adb root
More information:
- Android Studio Command-Line Reference
- Android Studio Command-Line SQLite3
- Android Studio SDK Platform Tools
Related Topics
How to Enable Logcat/Console in Eclipse For Android
Convert View to Bitmap on Android
Android: Java.Lang.Securityexception: Permission Denial: Start Intent
What Is Difference Between Getsupportfragmentmanager() and Getchildfragmentmanager()
Eclipse Error: R Cannot Be Resolved to a Variable
Singleton Object Becomes Null After App Is Resumed
How to Make an Alert Dialog Fill 90% of Screen Size
Accessing Localhost:Port from Android Emulator
More Than One File Was Found with Os Independent Path 'Meta-Inf/License'
How to Change Datepicker Dialog Color for Android 5.0
How to Simulate a Touch Event in Android
How to Disable Recyclerview Scrolling
How to Run a Method Every X Seconds