Android Debug Database: A Library for Debugging Android Databases and Shared Preferences

Android comes with a powerful built-in database called SQLite, but it doesn't come with the best set of debugging tools. When it comes to debugging databases in an android application, it is very difficult to see what’s happening inside the database. The same is true with Shared Preferences. In fact, unless you have a rooted device, you can't even get the SQLite tables off your device without jumping through some hoops.

Android Debug Database

Android Debug Database is a powerful library for debugging SQLite databases and Shared Preferences in Android applications. It allows you to view databases and shared preferences directly in your browser in a very simple way.
By using the Android Debug Database we can do the following:
  • See all the databases.
  • See all the data in the shared preferences used in your application.
  • Run any sql query on the given database to update and delete your data.
  • Directly edit the database values.
  • Directly edit shared preferences.
  • Delete database rows and shared preferences.
  • Search in your data.
  • Sort data.
  • Download database.

Android Debug Database Library in your application

Let’s take a look how we can implement it into our Android applications and debug the SQLite databases and shared preferences.
Complete source code for the examples used in this tutorial is available on github.

Creating New Project

We’ll start by creating new project in Android Studio and do the basic setup required.Create a new project in Android Studio from File > New Project and fill the project details.

Update Build Configuration

Open build.gradle located under app module and add android debug database dependency.

Create SQLite Database Handler Class

Create a new class in your project src directory and name it as ( Right Click on src/package > New > Class)
Now extend your class from SQLiteOpenHelper.

Insert Records

Update file to create the instance of class and add some rows.

Store Data Using Shared Preferences

Another way of storing data of an application is called Shared Preferences. Shared Preferences allow you to save and retrieve data in the form of key,value pair.
Create a Shared Preference instance and store some values.

Debugging Databases and Shared Preferences

Now we can debug the database and shared preference used in the app with the help of a web interface.
To do that do the following steps:
  • Your Android phone and laptop should be connected to the same Network.
  • If you are using it over usb, run adb forward tcp:8080 tcp:8080
Start the application, you will see in the logcat an entry like follows :
If you want use different port other than 8080. In the app build.gradle file under buildTypes do the following change :

Seeing Sqlite DatabaseScreen Shot 2017-04-12 at 10.25.16 PM-min.png

Editing ValuesScreen Shot 2017-04-12 at 10.25.35 PM-min.png

Run Sql QueryScreen Shot 2017-04-12 at 10.26.47 PM-min.png

Seeing Shared PreferenceScreen Shot 2017-04-12 at 10.26.19 PM-min.png


  1. These are really amazing and valuable websites you have share with us. Thanks for the informative post. Keep posting like these information.
    WordPress development company in Chennai

  2. Thanks for sharing Information to us. If someone wants to know about,I think this is the right place for you!

    Mobile App Development in Coimbatore
    Mobile app development company in atlanta
    3D Animation Company

  3. Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!
    web designer course in chennai
    web design development training in chennai
    web designing course with placement in chennai
    web design and programming courses in chennai
    web design and development training in chennai
    web designing courses in chennai
    web designing training and placement in chennai

  4. Thank you for sharing this! What you have shared is very helpful and informative. Would love to see more updates from you.

    Melbourne Web Designer

  5. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.

    Big Data Hadoop Training In Chennai | Big Data Hadoop Training In anna nagar | Big Data Hadoop Training In omr | Big Data Hadoop Training In porur | Big Data Hadoop Training In tambaram | Big Data Hadoop Training In velachery


Post a comment

Popular posts from this blog

How to Use Kotlin in Your Android Projects

Reactive Programming with RxBinding

Introduction to Spring Animation

Getting started with Android Fingerprint Authentication

Exploring Android O: Autosizing TextViews

Exploring Android O: Fonts in XML

Kotlin: Do more with less code

Introduction to Android Bottom Navigation View

Picture-in-Picture: Working in Android Oreo