Sometimes when developing applications we need to see the database. Android has a SQLite database and there is no direct option to view the database in Android Studio. So today we will learn to access SQLite database using ADB Shell. So if you are thinking How to access SQLite database in Android So keep reading.
Android sqlite tutorial
- If you want to learn how you can handle SQLite database in your Android application, just go through this playlist for a detailed description.
How to access SQLite database in Android?
Just follow these steps and you will be able to access and run queries for your SQLite database using a command prompt.
SDK Location Search
- First you need to find the SDK location of your system. Go for it File -> Settings.
- Now you can see the SDK location in the window.
Go to SDK location in command prompt
- Now open the command prompt and write the following command.
CD C: _the user _Belal _app data _Local _Android _Sdk
- Again run the following command.
- You are now inside the directory Stage equipment.
Enable adb route
- To access the database we have to enable adb root. For this, just run the following command.
- Now we will list all the running emulators and devices. For this, run the following command.
- This will show you all the running devices.
- As you can see I have only one device for now.
Connecting to device shell
- Run the following command to connect the shell to your device.
Wonder –s Emulator–Is 5554 The shell
- Don’t forget to change Emulator Name In the above command.
- And after running the command you will connect to the device.
Going to device’s database folder
- To access the database folder, run the following command again.
CD The data/The data/The trap.Simplified coding.androidmysqlsync/The database
- Don’t forget to change net.simplifiedcoding.androidmysqlsync With the package name of the application you want to access.
Connecting to SQLite Database
- Run the following command to connect to the SQLite database.
- In the above order NamesDB My database is name, you have to replace it with your database name.
- Bingo! We are associated with the database.
- Now you can run the command .help for SQLite Cheat Sheet To view or modify a database.
So this is how you can simplify your work of SQLite in Android. If you are having any confusion or trouble, feel free to leave your comment. Thank you 🙂
Hi, my name is Belal Khan and I am Google Developers Specialist (GDE) for Android. A passion for teaching made me this blog. If you are an Android developer, or you are learning about Android development, I can help you a lot with simplified coding.