Android emulator SQLite database locationandroid androiddev quick-post
December 18 2013 - 12:51
This is one of those quick posts, that teaches you how to solve a specific problem in a fast way.
Retrieving the database file from emulator
If you want to find your database file and even open it, there is an easy way. First through Eclipse IDE, go to the DDMS perspective (Window > Open Perspective > Other > DDMS).
YOUR APPLICATION MUST BE RUNNING SO YOU CAN SEE THE HIERARCHY OF FOLDERS AND FILES.
Then, in the File Explorer tab, follow the path data > data > your-package-name > databases > your-database-file. Here is an example picture:
Then select the file, click on the disket icon in the right corner of the screen to download the .db file. If you want to upload a database file to the emulator you can click on the phone icon(beside disket icon) and choose the file to upload. This will upload a database file to the emulator, and your application will read this database file.
Opening the database file
If you want to see the content of the .db file, I advise you to use SQLite Database Browser, which you can download here.
Another important note is:
If you want to see the database from a real device, you must root your phone.
When using new ADB Versions. e.g. ADB version >1.0.29
If you are using newer ADB versions, you will have some amenities, for example, you wont need to be on the DDMS perspective anymore, just open the File Explorer from Eclipse Window > Show View > Other. It seems the app doesn't need to be running even, you can browse around in different apps file contents.
Please share and comment. Also if you want to contribute to this blog, please click the Flattr button on bottom of this page or donate to my bitcoin 14LYjgbDDVTJnAffKeymPA75kzy5mhKKfM