DEV Community

Cover image for Deleting Android database from the command line
Tristan Elliott
Tristan Elliott

Posted on

Deleting Android database from the command line

Resources

My app on the Google play store

My app's GitHub code

Short and fast explanation

  • For those if you short on time, simply replace your.example.package and your_database_name with your own package/database name and run this command:
adb shell run-as your.example.package rm /data/data/your.example.package/databases/your_database_name

Enter fullscreen mode Exit fullscreen mode
  • If you get the error: unknown package, you can then run the command: adb shell pm list packages. Your package should be near the top of the list.

  • If you get the error: No such file or directory, this indicates that the specified database file does not exist at the given path. To check the location of the database run the command:

adb shell run-as your.example.package ls /data/data/your.example.package/databases/

Enter fullscreen mode Exit fullscreen mode
  • The database should be the first one listed

Conclusion

  • Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on Twitter.

Top comments (0)