I am installing and running an android application on my phone and for some testing purpose i want to see the databases of my application that is on my phone.
now my question how to get those databases and the tables????
please reply
thank you in advance.....
To view the contents of your local database you need to download a software called Sqlite Studio: http://sqlitestudio.one.pl/
1.) Download and install Sqlite Studio on your computer
2.) Connect your phone to your computer, make sure you turn on USB Debugging. USB Debugging can be activated from Settings -> Applications -> USB Debugging (or Settings -> Developer Options -> USB Debugging if you are using Ice cream sandwich).
3.) Open DDMS view in Eclipse and open the File Explorer tab in DDMS and then go to data -> data -> (name-of-your-application) -> databases. Now pull the data file from the databases folder onto your computer.
4.) Open Sqlite Studio and import the data file that you have just pulled from your android phone.
5.) View the contents of your database!
Hope this helped. Don't hesitate to clarify if you didn't understand!
The steps described by Vishwa is correct if we run on emulator. But for real devices we don't have access to data folder using DDMS. You need to have a phone with root access in order to browse the data folder on an Android phone. That means either you have a developer device (ADP1 or an ION from Google I/O) or you've found a way to 'root' your phone some other way.
Related
I have just started working on an Android project for work and I found a bug that requires checking the SQLite database my app is using on runtime, to search for inconsistent data.
I came back to working on Android just now, but I worked on Android projects years prior, and I remember using Device Monitor to check the database's tables and data on my device during runtime, but that feature has been deprecated and removed from Android Studio 3.2 (which I am using right now).
I have searched for solutions on Stack Overflow and beyond for hours now, and all solutions I found range from
copy the .db file from your device to your computer and open on a SQLite browser of your choice
to
download this super-shady-tool-that-has-few-to-no-features-at-all-and-can-barely-browse-the-database and after hours of browsing and editing configuration files and running commands on the console MAYBE you'll connect to the database on runtime
The first one I can't do because I need to view and run queries on the same database my app is currently using while debugging and the second one is not safe to try.
So I discovered the plugin Database Navigator for Jetbrains-related IDEs (https://plugins.jetbrains.com/plugin/1800-database-navigator) that promisses to give a nice UI for connecting and viewing data and running querys all from inside Android Studio, but I don't know how to configure a connection to a device during a debug process.
I found the Android Debug Database (https://github.com/amitshekhariitbhu/Android-Debug-Database) that actually works and is easy to configure, but I found it quite limited and runs on the browser (I would like something from inside Android Studio), although I set it aside as an "if anything else fails" solution.
My priority is to setup Database Navigator on Android Studio itself for easy work.
In Android Studio go to
View -> Tool Windows -> Device File Explorer,
there find your package name (for example, com.example.packagename),
then find folder 'databases' -> right click -> Save As... and save folder on your local machine.
Go to DB Navigator -> Settings -> + -> SQlite -> (Optionally) In the 'Name' field you can give a name to your connection and in the field 'Description' - description of your connection -> In the 'Database files' -> + -> Choose your db file, stored previously on your local machine.
Now you can use DB Navigator.
I was trying to establish database connectivity in Android. According to the tutorials I was referring to, it should show me some folders when I click on file explorer option in Windows tab. But no folder is shown there. Am I doing something wrong or is something wrong with the SQLite in my IDE?
Is the emulator or device is connected and running. If not please connect and click on that device from device list and then click file explorer.
For reference:
http://developer.android.com/tools/debugging/ddms.html
I have been using genymoton for quite some time now.
Could someone pls. tell me if there is a way by which I can access the files present in the sd card of genymotion emulator?
Currently I have to upload them to google driver and then download on windows.
You can use shared folder for that. It is well explain on this Google+ post.
Here is the brief:
Go to your VirtualBox VM setting / Shared folder tab
Add a shared folder with the folder you want to shared, and check the "auto mount" option
Start your VM as usual from the Genymotion software
Your shared folder is available in the /mnt/shared directory (multiple shared folders are supported)
This is also possible using the Android Device Monitor.
You already have this if you have the Android SDK installed.
This method works for all connected devices, including emulators like genymotion.
In Android Studio, click the icon that says Android Device Monitor in the toolbar.
(This is also available from Eclipse or you can just type monitor in the command line after moving to the tools folder of your installed sdk)
In the Android Device Monitor, go to the File Explorer tab.
Make sure you have a device selected on the left side.
Find the desired file and select it.
For the sdCard you might need to open the storage folder and open the sdcard there.
Click the button on top that says "Pull a file from the device".
Make sure you select Pull, not Push. Unless if you want to put new files on your device ofcourse.
Save the file to your computer...
and voila! The file from your genymotion is now among your other files on your computer. Ready to be used however you like.
Or alternatively you can also use a third party app like airdroid or any advanced file explorer to exchange files between your device and your computer.
(For installing third party apps you either need to find the apk or flash gapps on your genymotion first and go to the play store.)
Another way that I adopted, just install EsFileEx on genymotion.
Grab your files that you want to copy from e.g
/sdcard/WhatsApp/media/dp.jpeg
Swipe to LAN, here you can see your local machine as 10.0.3.2 or any IP. Here you can access your shared folder/drive of local machine/PC, past copied file here and you done!
NOTE! R/W permission should be set on shared folder/drive of local machine/PC
You can use the eclipse with the ADT plugin and browse the file system like any other android virtual emulators. I have been using this for a while, but eclipse crashes at some times.
I am creating a sample application which will create a database, Inserts data and finally displays it in a spinner.
For testing I am using my android phone instead of Emulator (As I am fedup with its slow response).
My problem is application running succesfully but spinner is not displaying any result also I am unable to view any folder structure under DDMS->data.
I am confused whether database created or not, Please suggest me how to view the database if we use real device instead of emulatpor
You must start you emulator, browse the emulator files in the DDMS view then select File explorer then go to data > data > com.your.package > databases > your_database_name and a new tab will appear with your data! It won't work on a real device.
You can even pull/export the database and analyse it more effectively with SQLite Browser
enjoy !
You can't get SQLite databse file from an Android real device if it is not rooted. Because to access the data folder of your application you have to provide the permission for it.
But you can run your application in an android emulator and following is the way:
From DDMS, in Devices menu select your emulator.
You can see data folder in File Explorer.
Path is: data->data->Application Package Name->Databases->Database Name
U just goto File Explorer
Windows>show view>File explorer>data>package>database name to see your database
in emulator
Where does the emulator data lie(the contacts, messages, saved images)?
Go to ddms,you can find the file explorer from that you will get application directry and sd card filed you can find all the detailed files there.
In ~/.android (that is your user directory/.android)
Each application stores its own data in its own private folder in /data/data on the emulator. Depending on the application it potentially can also store data on the /sdcard (e.g. downloaded images or whatever) which by convention should then be in /sdcard/Android/data/com.yourappspackage.and.so/ so that it gets cleaned up with uninstall but many apps also throw stuff all over the sd card (although they should not..)
More is on the dev site e.g. at http://developer.android.com/guide/topics/data/data-storage.html
All this is the same for the emulator as well as the real device. The emulator is just a virtual machine running on qemu.
You can use File Explorer tool in eclipse or ddms to View The data in the emulator
else use terminal to view the data using the command,
adb shell
Thank you,
Ganapathy.