Home > Mobile >  Clear ROOM Database Entries using Android Studio Database Inspector
Clear ROOM Database Entries using Android Studio Database Inspector

Time:08-04

I'm experimenting with ROOM Database Inspector on Android Studio.

I want to clear all entries from the database using a query on the inspector instead of having to uninstall and then reinstall the app to clear the data. I also know I could manually clear the cache from AppData but I just need to run a simple query instead of manual spadework.

I saw that I can write a query straight from the Database Inspector but I can't find how or the query to write. enter image description here

I also noted the database entries are only read-only enter image description here

Does anyone know if it is possible to clear/delete the database using the inspector query. If so which query can one use to clear everything off the database using the inspector.

CodePudding user response:

You can clear the app database using device file explorer in Android Studio:

data -> data-> your app package name -> databases -> database name

CodePudding user response:

I found out that running this command from the Inspector does it.

DELETE FROM table_name

You only need to click on Open New Query Tab and type the above command and then click Run button to your right.

enter image description here

The command clears the database giving you a cleanslate.

  • Related