This article will introduce how to check SQLite DB table in Android Studio in 2 ways.
1. Using "File Explorer" in Android Studio
Select [View] -> [Tool Windows] -> [Device File Explorer]
in Android Studio to launch the Device File Explorer.
In Device File Explorer, if you enter the directory /data/data/[package name]/databases/
, you can find the db file created by your app.
Click the Save As...
button to save it to your PC as follows.
The
/data/data/[package name]/
path is where the data of the app is stored, and the db file is stored under the databases folder.
1.1 Looking into Database file
To open the saved database file, you must install the Database Browser tool first.
You can download the SQLite Browser tool for each OS from sqlitebrowser.org. (If you are using a database other than SQLite, you can install a browser that can open the file.)
For Linux users, you can install and run sqlitebrowser with the following command.
$ sudo apt install sqlitebrowser
$ sqlitebrowser
If you run SQLite Browser and open the db file saved above, you can see which items are saved as follows.
2. Using "Android Debug Database" library
This library is for debugging Database and SharedPreferences. No need to root, just make sure your device and PC are connected to the same network.
When you run the app, the library creates a webpage so you can easily debug the database on your PC.
You can find more information about the library at GitHub - Android Debug Database.
2.1 How to use
Add the following dependencies to build.gradle
.
dependencies {
...
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
}
And put it in Applicaiton or Activity so that the following code is executed.
This code prints the address of the webpage. So, you only need to put it where the code can be executed.
DebugDB.getAddressLog()
Now, if you run the app, DebugDB.getAddressLog()
outputs the following log. You can copy the address of the log and run it on the web page.
08-30 16:53:08.947 10204 10204 D DebugDB : Open http://192.168.0.11:8080 in your browser
If you access http://192.168.0.11:8080
in your browser, you will see the following page.
Related Posts
- How to download and build Android 13, AOSP
- Notification permission request, pop up notification in Android 13
- Resolve `Access blocked: ComponentInfo` error on Android 13
- Fix error "android gradle plugin requires java 11 to run. you are currently using java 1.8."
- Android - Vibration, Vibrator, VibrationEffect example
- How to get phone number in Android
- How to create Bugreports and Logcat with ADB in Android
- Clear application user data with ADB in Android
- How to disable/enable apps with ADB in Android
- How to find PID of a package with adb in Android
- How to grant/revoke permissions with adb in Android
- How to install an apk(app) with adb in Android
- How to kill a process/package from ADB in Android
- How to transfer files using adb push/pull command in Android
- How to capture the screen from adb in Android
- How to uninstall/install system apps from adb in Android
- How to change Settings values from adb in Android
- How to Factory reset with ADB in Android
- How to get logcat from ADB command in Android
- How to capture Heap Dump from app with ADB in Android
- How to force stop an app with adb in Android
- How to start/stop a service from adb in Android
- How to send/broadcast an intent from adb command in Android
- How to start an activity from adb in Android
- How to generate input from adb in Android
- How to check SQLite DB table in Android Studio
- How to get memory info and thread list from adb in Android
- Android - Uri, Scheme and SSP(Scheme Specific Part)
- How to parse a xml file with XmlResourceParser in Android
- Android - Signing an apk with Platfom key
- How to fix "Cleartext HTTP ... not permitted" for Android development
- How to fix "kvm permission denied" for Android Emulator
- Using ADB over Wifi for Android development