Debugging a sqlite database on you android device.

I found this tool, aSqliteManager. It’s not the only tool/app of it’s kind, there are a few similar looking tools. It’s basically a database browser that runs on you android device. So what use is this? It depends, if you developing a android app with a complex database, it can be a great time saver, if not. then you probably have no use for it. So how do i use this? Grab one of the apps from the play store, this is the one i used:

https://play.google.com/store/apps/details?id=dk.andsen.asqlitemanager

And I do not recommend this over any other since its the only one I had time to test, I you know of a better one please leave a comment! And the only other thing needed is a small change to your SQLiteOpenHelper class:

public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    MySQLiteOpenHelper(Context context) {
        super(context, "/mnt/sdcard/database_name.db", null, 0);
    }
}

This will create a new database that is located in the root of the sdcard, and readable by all. So DO NOT leave it like this when you’re done debugging, but change it back to “database_name.db” as soon as you are done debugging.

Fire up the database manager and select your database. To make this even better, try swapping between the database manager and your app while it is running.

This Post Has 8 Comments

  1. Greetings:

    Your answer is very helpfull. :):):)

    Arfan

    1. Happy to help!

  2. Amazing! Thank you very much! I don’t want to root my device and I was trying to find a solution to access my database for hours!
    I really appreciate your solution! :)
    Cheers!

    1. I’m glad you found the post helpfull!

  3. Easy and nice article.
    Thanks

  4. Thanks mate

  5. Thanks a million for this!
    I was struggling with a bug for hours until I found this post.
    P.S. I think that there is a need to mention that permissions to write to the SD should be added to manifest.xml file

  6. Maybe your steps are useful but debugging an Android device is quite difficult. The same thing happens when we have to debug iOS. I never took any risk and called Apple Customer Support to do that. They do this always on behalf of me.

Leave a Reply

Close Menu