26

I am using Database Inspector in Android Studio 4.1 Canary 10 (Build #AI-201.7223.91.41.6507185) and as this is a new feature, I am encountering many bugs. And there are a lot of event log popups as follows:

Database Inspector: Error reading Sqlite database: Unable to perform an operation on database (id=8). The database may have already been closed.

And it keeps on crashing my application right after app launch.

So my question is how do I detach database inspector from my process? Once I attach a process or just open the database inspector, it just doesn't leave my app alone until I restart the android studio. Is there some way I can terminate the database inspector any time?

Ashu
  • 2,970
  • 1
  • 19
  • 31
  • Any luck with that? I have the same problem, even now that it is in production... :-( – Stéphane Péchard Oct 14 '20 at 15:55
  • I got a simple solution not to use the DataBase inspector. remove it from the bottom menu. if you not click on it studio work properly. the problem comes after you open the 'Database inspector tab' remove process: Right-click on database inspector -> remove form slider – Anil Ugale Oct 15 '20 at 07:34
  • I have the same problem ( – Krushik Oct 15 '20 at 09:21
  • 6
    same issue on android studio 4.1 (stable version) :( – Abu Nayem Oct 15 '20 at 12:07
  • No luck with it. It is still a nightmare to use :( By not having a way to close it, this feature is just redundant, you can't use it anyway. – Ashu Oct 15 '20 at 14:23
  • I can't believe this is an issue in stable version and wasted almost my whole day – Anmol Nov 04 '20 at 07:14
  • Same problem here. I tried it once, it didn't work, now it restarts every time I debug the app and causes the app to kill itself or detach from the debugger. Removing/Restarting Android Studio hasn't solved it. – Sollace Dec 14 '20 at 07:26
  • is there some way to do it from the terminal ?? – Pemba Tamang Oct 23 '21 at 15:19

4 Answers4

10

Finally, in Android Studio 4.2.0 they have added a button to stop the database inspector.

Android Studio 4.2.0+
Database Inspector -> (device list dropdown in top-left corner) -> Stop Inspector

Below 4.2.0
File -> Invalidate Caches/Restart -> Just Restart (no need to invalidate caches)

P.S. You can check your android studio version from: Help -> About

Ashu
  • 2,970
  • 1
  • 19
  • 31
  • The restart button doesn't really work - post stopping trying to reinspect spits the same error (version: Android Studio Chipmunk | 2021.2.1 Patch 1) – lineage Jul 23 '22 at 07:48
5

File -> Invalidate Caches/Restart -> Invalidate And Restart

Do not open this tab again.

lusmail
  • 59
  • 1
  • 2
1

Close Android Studio completely and open it and don't open the database inspector tab again.

faraz khonsari
  • 1,924
  • 1
  • 19
  • 27
0

You could also close the application on your phone device or emulator. after that the process status becomes DETACHED in the database inspector tab. when you open your app again a new one will show up and you choose that.

narcis dpr
  • 939
  • 2
  • 12
  • 32