I'm running Android Studio 1.3 and working on tutorial app. I'm using GenyMotion for testing purpose. I have written some code to create a database. Now I want to see whether that database has been created or not. If yes then where it is stored. In Eclipse we used to have DDMS Monitor but no such thing is present in Android Studio. So How to do so?
Easiest way is using Android Device Monitor to get the database file and SQLite DataBase Browser to view the file while still using Android Studio to program android.
1) Run and launch database app with Android emulator from Android Studio.
2) Run Android Device Monitor. How to run?; Go to [your_folder] > sdk >tools. You can see monitor.bat in that folder. shift + right click inside the folder and select "Open command window here". This action will launch command prompt. type monitor and Android Device Monitor will be launched.(There are other ways to open this too. Search it)
3) Select the emulator that you are currently running. Then Go to data>data>[your_app_package_name]>databases
4) Click on the icon (located at top right corner) (hover on the icon and you will see "pull a file from the device") and save anywhere you like
5) Launch SQLite DataBase Browser. Drag and drop the file that you just saved into that Browser. (You can view the database using any SQLite browser of your choice)
6) Go to Browse Data tab and select your table to view.
Related
The sqlite base file is stored in path data/data/my-package-name/databases/mybase.db
(Where does Android emulator store SQLite database?)
Sometimes, i get this file on a remote real device and i would like to copy it to android emulator on my Android Studio for debugging. In other words, i want that my application on Android Studio uses this base. How can i do it?
Another possibility: how to copy this base to a my real device who is connected to PC by USB cable
thanks a lot,
regards
Start your emulator.
Open Device File Explorer (a tab button at the bottom right side of Android Studio).
Go to the folder data/data/my-package-name/.
If there is no subfolder databases then create it by right clicking on the my-package-name folder and then New->Directory where you type databases and click OK.
Now right click on the folder databases and click Upload....
Navigate to the SQLite file that you want to copy, select it and click OK.
I have an app running on my device. I am able to store and retrieve data, the question is how to view it? is there any gui available. I tried looking on the android device monitor while running my app at taskbar but under data nothing is available.
IDE: Android Studio
In Android Studio
Tools--> Android --> Android Device Monitor
In Android Device Monitor
Window --> Show View --> Android --> File Explorer
in File Explorer
data --> data --> Your Package Name --> databases --> sample.db
Pull the db file & you can browse your dbms using sqlite browser
Reference Screenshots
To pull the db file
If you are using real device then you cannot see the database in Android Device Monitor.
If you need to see your database then launch your application on Emulator and do the following steps:
Launch the Android Device monitor.
Select your package name
Click on File Explorer in DDMS window.
Go to data -> data -> your package name -> databases
You can export the file and view it in a sdf/sqlite browser.
Hope it helps.
I am looking at tutorials and for some reason I can not find the mysharedpremain.xml file. In my android studio I dont have a data tab.
Can somebody help? The image of the tutorial is below
Thank you
There is no such tab called data in android studio. data/data is the place where the android system stores your application and it's related fies,To see your application and related files you need to access the android file system.
In order to do that follow the below steps
Run your app in an emulator or in a rooted android device
open android device monitor as described in the image you posted
on the left side of the window you will see devices tab click on the emulator/device on which your app is currently running.
Click on file explorer tab and select data folder inside that you will find one more data folder select it and search for package name that matches your app package name and expand it..you will find your preference file if you already created one
I have been trying to create the app with sqlite db using cordova-2.9.0. I can't see the //data/data/ in emulator DDMS of android Eclipse.
Could anybody guide to me.
thanks and regards
brite
You have to bring up the File Explorer View from the Android View options.
Window -> Show View -> Android -> File Explorer.
And then, go to the Devices View and select the device from the list. (You should see the device in this screen if it's connected in Debug mode)
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