Android Device Monitor File Explorer not working with emulator running API 24+

AndroidAndroid Studio

Android Problem Overview


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+.

Any solution?

enter image description here

Android Solutions


Solution 1 - Android

Till Android Lollypop emulators, we can access the file explorer folders. If the emulator is created with marshmallow or higher, we cant access the file explorer. May be this is bug from API level 24+.

Solution 2 - Android

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

Solution 3 - Android

A workaround using the adb command line tool:

root@mypc ~ $ adb kill-server
root@mypc ~ $ adb start-server
root@mypc ~ $ adb root

Now you can browse through the file system using the linux ls command:

root@mypc ~ $ adb shell ls -all /
total 3688
drwxr-xr-x  15 root   root         0 2017-04-21 11:11 .
drwxr-xr-x  15 root   root         0 2017-04-21 11:11 ..
drwxr-xr-x  29 root   root         0 2017-04-21 11:11 acct
drwxrwx---   6 system cache     4096 2017-01-06 12:11 cache
lrwxrwxrwx   1 root   root        13 1970-01-01 01:00 charger -> /sbin/healthd
...
-rw-r--r--   1 root   root      4853 1970-01-01 01:00 ueventd.rc
lrwxrwxrwx   1 root   root        14 1970-01-01 01:00 vendor -> /system/vendor

Solution 4 - Android

This is bug in Android Device Monitor and has been reported to google.

According to Post this thread will be updated when the patch is released.

Solution 5 - Android

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

Solution 6 - Android

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.

Solution 7 - Android

Its an alternative way.

Create a bat file configure the APP_NAME, Example (com.example.com)

DESTINATION_FOLDER (myProjectFiles)

cd "C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools\"
adb shell run-as APP_NAME rm -R /sdcard/DESTINATION_FOLDER
adb shell run-as APP_NAME cp -R cache/ /sdcard/DESTINATION_FOLDER
rmdir C:\Users\USERNAME\Documents\DESTINATION_FOLDER /s /q
adb pull /sdcard/DESTINATION_FOLDER C:\Users\USERNAME\Documents\
timeout 5

After Configuring your bat file run it by double clicking . it will do the rest

Solution 8 - Android

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

Solution 9 - Android

I had this problem with Api 27 (Oreo). I tried to create emulator with Lollipop but same as with Oreo. Device monitor was empty.

After restarting computer everything was normal. This is solution for many problems that comes with Android Studio. First check this, than everything else.

Solution 10 - Android

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();

Solution 11 - Android

Try some methods:

  1. Click on the triangle icon at the device window then choose "reset adb."
  2. Turn off the emulator then turn it back on.
  3. You can use Genymotion, the best simulator now.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJuan OlivaresView Question on Stackoverflow
Solution 1 - AndroidRamesh BandariView Answer on Stackoverflow
Solution 2 - AndroidAurimas RekštysView Answer on Stackoverflow
Solution 3 - AndroidkiltekView Answer on Stackoverflow
Solution 4 - AndroidAmit BhatiView Answer on Stackoverflow
Solution 5 - AndroidAnel Rojas HernándezView Answer on Stackoverflow
Solution 6 - Androidvladimir123View Answer on Stackoverflow
Solution 7 - AndroidRajView Answer on Stackoverflow
Solution 8 - AndroidshivaprasadView Answer on Stackoverflow
Solution 9 - AndroidŠemsudin TafilovićView Answer on Stackoverflow
Solution 10 - AndroidA-SharabianiView Answer on Stackoverflow
Solution 11 - Androidsonnv1368View Answer on Stackoverflow