I figured out an easy way to debug my database without using or copying the database. I just installed the simple and free SQlite manager on my device, and I added the static final lines to the SQLLiteOpenHelper class:
private static final String DATABASE_NAME = "myDatabaseName.db"; private static final String DATABASE_NAME_DEBUG_PATH = "/mnt/sdcard/";
Then I install the private constructor as follows:
//Defaut constructor. private DatabaseHelper(Context context) { //Allow database access without rooting the device. super(context, (BuildConfig.BUILD_TYPE == "debug") ? DATABASE_NAME_DEBUG_PATH + DATABASE_NAME : DATABASE_NAME, null, DB_VERSION); }
Thus, your SQlite manager will find your database during debugging, because it will be located in your sd, and you can see it without problems and without rooting.
source share