Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear ROOM Database Entries using Android Studio Database Inspector

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.

like image 663
Tonnie Avatar asked May 10 '26 18:05

Tonnie


2 Answers

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.

like image 199
Tonnie Avatar answered May 12 '26 07:05

Tonnie


You can clear the app database by deleting its file using Device Explorer - Files in Android Studio, the database file path is:

data -> data -> your_app_package_name -> databases -> database_name.db
like image 41
Amirhosein Heydari Avatar answered May 12 '26 09:05

Amirhosein Heydari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!