2

I have just started working on an Android project for work and I found a bug that requires checking the SQLite database my app is using on runtime, to search for inconsistent data.

I came back to working on Android just now, but I worked on Android projects years prior, and I remember using Device Monitor to check the database's tables and data on my device during runtime, but that feature has been deprecated and removed from Android Studio 3.2 (which I am using right now).

I have searched for solutions on Stack Overflow and beyond for hours now, and all solutions I found range from

copy the .db file from your device to your computer and open on a SQLite browser of your choice

to

download this super-shady-tool-that-has-few-to-no-features-at-all-and-can-barely-browse-the-database and after hours of browsing and editing configuration files and running commands on the console MAYBE you'll connect to the database on runtime

The first one I can't do because I need to view and run queries on the same database my app is currently using while debugging and the second one is not safe to try.

So I discovered the plugin Database Navigator for Jetbrains-related IDEs (https://plugins.jetbrains.com/plugin/1800-database-navigator) that promisses to give a nice UI for connecting and viewing data and running querys all from inside Android Studio, but I don't know how to configure a connection to a device during a debug process.

I found the Android Debug Database (https://github.com/amitshekhariitbhu/Android-Debug-Database) that actually works and is easy to configure, but I found it quite limited and runs on the browser (I would like something from inside Android Studio), although I set it aside as an "if anything else fails" solution.

My priority is to setup Database Navigator on Android Studio itself for easy work.

halfer
  • 19,824
  • 17
  • 99
  • 186
José Silva
  • 51
  • 1
  • 6
  • This isn't the answer you're looking for, but Facebook Stetho will allow you to view and navigate running debug apps (where stetho is installed) – em_ Jan 21 '19 at 21:07
  • @ElliotM I found Android Debug Database easier to use and configure, but thank you! I would really like something close to Android Device Monitor running inside Android Studio, it's waaaaaay easier to work with. Why did Google deprecate it anyways? – José Silva Jan 21 '19 at 21:13
  • I'll have to check that Android Debug Database library out, I've no clue why the deprecation was introduced - would like to know myself :D – em_ Jan 21 '19 at 21:21
  • You may find this of use [Are there any methods that assist with resolving common SQLite issues?](https://stackoverflow.com/questions/46642269/are-there-any-methods-that-assist-with-resolving-common-sqlite-issues) or even this [SQLiteInformationAssistant](https://github.com/Mike-j-t/SQLiteInformationAssistant) – MikeT Jan 21 '19 at 23:07

1 Answers1

1

In Android Studio go to View -> Tool Windows -> Device File Explorer, there find your package name (for example, com.example.packagename), then find folder 'databases' -> right click -> Save As... and save folder on your local machine. Go to DB Navigator -> Settings -> + -> SQlite -> (Optionally) In the 'Name' field you can give a name to your connection and in the field 'Description' - description of your connection -> In the 'Database files' -> + -> Choose your db file, stored previously on your local machine. Now you can use DB Navigator.