SQlite – enable log events and see it in logcat

Create .bat file with commands provided below:

adb shell setprop log.tag.SQLiteLog V
adb shell setprop log.tag.SQLiteStatements V
adb shell su 0 stop
adb shell su 0 start

After You execute app, You (in this case) emulator will reboot.

Now search in logcat something like this below:


Simple pulling database sqlite to desktop and preview it

All what we need is to make few steps:

  1. Add in our project this line to output in log current path to database
    Log.d(TAG, "onCreate db: " +  context.getDatabasePath("mydatabase.db"));
  2. Create simple batch command to pull database (afik root is no needed)
    adb pull "/data/data/com.example.app/databases/mydatabase.db" mydatabase_%date%.db.sqlite
  3. Download SQLiteManager to firefox, run it, open our sqlite database


Zrzut ekranu 2016-02-16 12.15.38




Good luck!