Wednesday, February 10, 2016

Step to connect to Sqlite3 via ADB Shell

1- Go to your platform-tools folder in a command prompt


2- Enter the command adb devices to get the list of your devices
List of devices attached
emulator-5554   device

3- Connect a shell to your device:

adb -s emulator-5554 shell

4- Navigate to the folder containing your db file:
Note: If you did not have databases folder create it using mkdkir databases

cd data/data/com.example.siddhu.addition/databases/

5- run sqlite3 to connect to your db:

sqlite3 Siddhu.db

6- run sqlite3 commands that you like eg:

Select * from table1 where ...;

To know where sqlite database stored created by you in android studio, you need to follow simple steps:

1.Run your application
2.Go to Tools--->Android---->Device Monitor
3.Find your application name in left panel
4.Then click on File Explorer tab
5.Select data folder
6.Select data folder again and find your app or module name
7.Click on your  database name
8.On right-top window you have an option to pull file from device.
9.Click it and save it on your PC
10.Use FireFox Sqlite manager or sqllite Studio software to open that file

No comments: