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 ?
I am using room database . I can see the database on device . Why is the database not showing up in database inspector?
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.
If you are using Android Studio Arctic Fox | 2020.3.1 then Database Inspector is under App Inspection. As below.
A workaround is to restart your device. Works for me
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
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
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
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.
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.
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.
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
Enable the "keep database connection open". I think its not showing because of .close(). See the image for your reference.
See image
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
Follow these steps,
View -> Tool Windows -> App Inspection
Run the project
Then you can see the "Database Inspection"
Database Inspection in android studio arctic fox 2020.3.1 patch 3
had to restart emulator and started working again
I face this issue on many devices. Kill the app process and run again. The application should be in the foreground.
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
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
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.
Select debug build variant.
Keep the device connected and deploy the app on the device.
Deleting app cache in simulator worked for me ;)
Related
I'm having three not rooted phones here. Two of them have Android 10 and one has Android 8.0. On one with Android 10 I just cant access the app files in /data/data directory with the Device File Explorer in Android Studio.
The error I get is:
`run-as: /data has wrong owner: 0/1000, not 1000ยด
I'm just not finding anything useful to fix this.
Since I had to dive into the comments of the original question to solve it for myself, I'll repeat the answer that helped me.
I uninstalled the app, restarted my phone, installed it again with android studio and it worked like a charm after that.
In case you're still looking for an answer.
This most likely happens when your database is created in the past (probably from some code that was a bit off). I advise you to delete the existing database from the device file explorer, make sure your code is right, and re-run the app.
This should create a new database and work.
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.
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.
I just installed Android Studio and want to start a new project. But it showed the following error message:
The path XYZ is not writable. Please choose a new location
How should I fix this problem?
The most likely explanation is that the directory and all its files are owned by a different user account on the system. Normally the "Clear Read-Only Access" dialog will fix up read permission problems if it's possible to do so; if it's not (because the files are owned by another user), the dialog will refuse to let you click the OK button.
You can confirm this by using the ls command from the MacOS terminal. Here's an example from a random project of mine.
I had the same issue. Running Android Studio as an administrator worked for me. If this is a possibility for you and you did not do it before, give it a whirl.
I got that error on windows because the initial project location was C:\. But the problem was solved when I made a folder and gave that path:
C:\repo\myApplication
Myself also faced the same problem because , I have changed the permission of that drive from x:\ -> properties -> security . Once I have given full control for my user option(one among 4 options in security) and reopening the Android studio , it didn't post that warning again. So, before you try this option , please verify the security details of drive and make sure that it doesn't affect your further operations regarding security.
I was having this same problem, then I plugged in a flash-drive. It allowed for a place to store the files with a location that did not have white space, was empty, and had enough room to store everything I needed. The flash was the only way I found on my computer to store the files where the path was writable. Hope this helps someone.
You can create that folder (or those folders) yourself, then run the installer again.
I am trying to use the Android Device Monitor within Android Studio, but somehow I managed to remove all views.
I have tried resetting the perspectives, Window->Show View->(Any View), and even re-installing Android Studio but nothing shows up.
Does anyone know how to reset the Device Monitor back to it's default views? (With the devices on the left, and the heap/threads/allocation views on the right.)
Thanks for your help!
I've experienced this same problem by using Window -> Reset Perspective. One should expect this to fix this issue, not break it. Go figure.
In any case, the DDMS workspace preferences are stored in %USERPROFILE%\.android\monitor-workspace (e.g. C:\Users\my_user\.android\monitor-workspace).
Just delete that folder and you're good to go.
Note that you'll need to enable 'show hidden files' in the finder if you are on a mac. Then, the workspace directory is in users/your_username/.android/monitor-workspace.
See http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/ for how to show hidden files.
On Windows:
Go to C:\users\my_user\.android\monitor-workspace)
Close android device monitor
Delete all files/folders inside of monitor-workspace folder
Run android device monitor again
Where "my_user" is your user folder.
That screenshot looks like you are running Windows. So, you could go to C:\Users\user3106174\ and delete the directory named .android (or something similar).
So i have been looking for this answer for the past 2 days. all of them want to know how to extract the database file .sql from the device your testing your app on. What i want to do is use a manager, like fire fox's sqlite manager, to open the location of the file and view the data base as information is being entered. I did this once when i was using titanium, but now have switched to eclipse. So what i want is, when i am running my virtual machine, android emulator, i want to fine the location that it is reading the sql file from. doing this i can open it with my fire fox manager and as info is going into the file the manager will show me whats going in and out. Basically i want to see real time info from my internal database, either from emulator or phone. PLEASE HELP!
Go to this link and get the SQLiteManager plugin for eclipse.