40

I am on Android studio 4.1 beta 1 . I installed my app on my device and opened Database Inspector and nothing shows up . Am I supposed to do anything else ?

enter image description here

I am using room database . I can see the database on device . Why is the database not showing up in database inspector?

Manohar
  • 22,116
  • 9
  • 108
  • 144

21 Answers21

25

In my case, it showed me the same process a lot of times. And none of them worked.

The solution was Invalidating the Cache:

File -> Invalidate Caches/Restart -> Invalidate and restart

After that everything started working again.

Jorge Casariego
  • 21,948
  • 6
  • 90
  • 97
19

If you are using Android Studio Arctic Fox | 2020.3.1 then Database Inspector is under App Inspection. As below.

enter image description here

Sujit
  • 10,512
  • 9
  • 40
  • 45
17

A workaround is to restart your device. Works for me

mujeeb
  • 169
  • 1
  • 3
11

I solved this problem by uninstall and then installing app again. Formerly when I had face to this issue, I could run database inspector just by close/open app but now it start working just by uninstalling

Update

after more working with database inspector I understand some times it just needs a few seconds to connect and no need to do anything else

Vahid
  • 1,588
  • 4
  • 22
  • 34
8

I face 2 cases:

  • First time connect to my device and database does not show, then i do an action to modify database -> database will show.

  • After I use ADB Idea to clean app data or uninstall (or go to settings and clear cache or uninstall app) -> database does not show -> restart device -> database will show

Robust
  • 2,415
  • 2
  • 22
  • 37
5

Looks like its problem with device . If you have some custom rom installed then you might run into this issue . Link to the issue tracker https://issuetracker.google.com/issues/159432618

Manohar
  • 22,116
  • 9
  • 108
  • 144
  • 1
    I am using Android Studio4.1 stable. No database is showing . Take a look here ; https://imgur.com/RsYj5ql – xaif Oct 13 '20 at 05:08
  • 1
    I guess that's it. I have a custom ROM installed, and it just says deploy your app to a device running API level 26 or higher, or select a debuggable process to inspect. I'm running API 29 and have already selected the debuggable process; still nothing. – hamthenormal Dec 26 '20 at 05:28
  • restarting device worked for me – konnovdev May 23 '22 at 04:50
  • They should add this on docs. Or fix it – Estevanbs Jul 11 '22 at 18:40
3

Well here is what was happening with me - Android Studio wouldn't pick up my connected device at all with the message "Error initializing adb : android debug bridge not found" when I tried to use Device File Explorer.

Turned out my project level sdk wasn't set correctly. Fixing that worked.

File -> Project Structure In Project, select valid Project SDK In Modules -> myapp_android -> Dependencies, select a valid Module SDK.

You should now be able to select connected devices from the database inspector. Flush your cache and restart (File -> Invalidate Caches/Restart and select "Invalidate Caches and Restart") for good measure.

rasulfahad
  • 443
  • 3
  • 13
2

In My Case, I forgot to open the database view inside the Database Inspector window as mentioned in the screenshot. Click on the database menu option as highlighted in yellow.enter image description here

Zeeshan Akhtar
  • 441
  • 1
  • 4
  • 9
2

Follow these steps,

  1. View -> Tool Windows -> App Inspection
  2. Run the project
  3. Then you can see the "Database Inspection"

Database Inspection in android studio arctic fox 2020.3.1 patch 3

[![][1]][1]
[1]: https://i.stack.imgur.com/QGyjz.png

Amal
  • 261
  • 4
  • 9
2

In my case I was using an emulator and I came to know that its mentioned and configured storage was about full.

So I just wiped all data of emulator and restarted the app inspection tab now this time I was able to view the db tables in the inspector window.

Ali Nawaz
  • 2,016
  • 20
  • 30
1

Still so many problems with this how did it make it into stable? open the database inspector close your app reopen your app, app crashes,

Start your app open the database inspector restart your app, database inspector is gone cannot be brought back without uninstalling and reinstalling your app

Great

martinseal1987
  • 1,862
  • 8
  • 44
  • 77
1

Enable the "keep database connection open". I think its not showing because of .close(). See the image for your reference.

See image

Jim
  • 39
  • 2
1

I faced the same problem, I Open the Layout inspector and after that, I open the Database inspector, It works for me. seems like a bug of android studio

Akshay Raiyani
  • 1,243
  • 9
  • 21
1

had to restart emulator and started working again

nGL
  • 333
  • 3
  • 12
0

I face this issue on many devices. Kill the app process and run again. The application should be in the foreground.

Amirhosein
  • 4,266
  • 4
  • 22
  • 35
0

Every time I faced with this issue, I'd unplugged the usb cable, then plugged it again. Then make sure the database inspector window is open. After that, every time the database is accessed, it'd appear in the window

Irfandi D. Vendy
  • 894
  • 12
  • 20
0

In my case, I had two databases in assets under the same directory and only one was showing on the inspector no mater how many times I killed and restarted the process. In the end I found that it was not showing up because I needed to store the second database file in a separate folder

structure assets > folder > db_file.db assets > other_folder.db > other_db_file.db

such that the folder and the database file had the same name.

Example assets > my_database.db > my_database.db

After that, both databases showed up on the database inspector

Shay Ribera
  • 359
  • 4
  • 18
0

I was emptying the cache (cache and code_cache) at each startup of my application.

When I did comment the line and stop deleting the cache, and unplug/plug back the phone, I got the database inspector showing my tables back again.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Antoine Driot
  • 46
  • 1
  • 1
  • 5
0
  1. Select debug build variant.
  2. Keep the device connected and deploy the app on the device.
Bruce
  • 793
  • 8
  • 17
0

Deleting app cache in simulator worked for me ;)

0

New Way to see Database Inspector

In new android studio versions, "Database Inspector" is display inside "App Inspector" in bottom bar options, Just expend App Inspector:

enter image description here

Abdul Waheed
  • 562
  • 6
  • 14