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

前端 未结 11 955
暖寄归人
暖寄归人 2020-12-13 12:07

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

相关标签:
11条回答
  • 2020-12-13 12:45

    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();
    
    0 讨论(0)
  • 2020-12-13 12:48

    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
    
    0 讨论(0)
  • 2020-12-13 12:51

    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

    0 讨论(0)
  • 2020-12-13 12:54

    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.
    0 讨论(0)
  • 2020-12-13 12:57

    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

    0 讨论(0)
  • 2020-12-13 13:01

    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.

    0 讨论(0)
提交回复
热议问题