So, just as question states. Android device monitor is not showing anything in the File Explorer view. This is only occuring on Virtual Devices running Android API Level 24
As another workaround, I use fileList()
to get all the files in the Files
folder of my app and log it to logcat:
String[] files = fileList();
// log files, or add a watch in the debugger...
It is also possible to get the files and directories in your cache
folder as well:
String[] filesInCache = getCacheDir().list();
Or
File[] filesInCache = getCacheDir().listFiles();
Another temporary solution is to use the adb shell
First, copy the database to the sdcard
./adb shell run-as com.yourapplication cp /data/data/com.yourapplication/databases/yourFileName.db /sdcard
Then, pull the database file to your computer
./adb pull /sdcard/yourFileName.db /Users/yourUserName/Desktop
I also faced same problem in the Android Device Monitor.
The emulator we use is very high level like Nougat 24+, so to over come this, we have to just run emulator in level level i.e., Lollipop 22
Try some methods:
A temporary solution, which worked at least for my needs, was to install file manager .apk (I used Astro file manager .apk) - just drag/drop .apk to emulator window. Another very useful utility - ImDisk - which let's mount sdcard .img of virtual device. If you mount it as readonly ejectable device, you can have realtime access to virtual device file system
It probably has to do with the new Android folder permissions. As posted in another answer you can use:
root@mypc ~ $ adb root
to gain root access to your emulator (no need to restart the adb). Then you can see all the folders on the device with DDMS file explorer or through the shell. The other option is to wait for a new file explorer that was promised in version 2.4 of Android Studio.
If you need to refresh the gallery after that as I did you could use:
root@mypc ~ $ adb shell "am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/sdcard"
This will simulate mounting of a SD card which will trigger media rescan.