0

How can I view the DB in IntelliJ to view its content and perform operations on it. Now I have created my tables etc but i have no idea what data is on the DB and I do not want to create queries in java to check it. seems like a slow workflow so ill wait til I know how to access the db that resides on the Android emulator im using.

Is it possible?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
vasper
  • 11
  • 6

3 Answers3

2

You can also use Stetho. A nice debugging tool from Facebook.

Just simple to use, initialize it in your Application class and access your sqlite and even shared preferences from Google Chrome's developer console.

alxsimo
  • 567
  • 1
  • 6
  • 19
  • BTW, don't use it in production see this [question](http://stackoverflow.com/q/30172308/1523910) regarding that. – Avinash R Jul 24 '16 at 16:50
  • Right! You should use it with flavors or Dagger. Enabling it for example only on debug flavor. – alxsimo Jul 24 '16 at 16:51
0

see @alexsimo's answer.

Without root you cannot access your database on your device, unless the file is created with a+r permissions.

Since that is something that is unrelated to the issue, you can just search in plugin.jetbrains.com for sqlite and get a variety of plugins.

Community
  • 1
  • 1
Avinash R
  • 3,101
  • 1
  • 27
  • 47
0

You can create a database file outside of Android and use any tool to create and read it.

Then, you place it in the assets folder and setup your code to read the database from there instead of private app data. Caveat here is that a copy will be made from the assets folder to the app data, so any updates within the app won't be mirrored to the database file in the assets folder.

I believe you can access the DDMS window in Intellij/Android Studio and there is a Database Explorer there

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245