(re)mounting the SD card on android emulator

匿名 (未验证) 提交于 2019-12-03 02:14:01

问题:

On the emulator, I can unmount the SD card from the Settings.

I can then mount it on my OS, then unmount it normally.

I haven't been able to figure out how to re-mount it then on the emulator (without rebooting it).

hints:

  • the adb command remount is unrelated: it's about /system
  • the emulator command is unrelated: it's only about starting the emulator
  • mounting the SD card in two places of course messing everything up (I tried)

more:

  • mount outputs the following:

    /dev/block//vold/179:0 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0

  • trying to mount again from the shell after unmounting it, using the same options as above, gives a segfault

  • no idea why the double slash in block//vold, I guess it's just a typo

回答1:

The developers guide suggests that this isn't possible:

SD Card Emulation

You can create a disk image and then load it to the emulator at startup, to simulate the presence of a user's SD card in the device. To do this, you can use the android tool to create a new SD card image with a new AVD, or you can use the mksdcard utility included in the SDK.

The sections below describe how to create an SD card disk image, how to copy files to it, and how to load it in the emulator at startup.

Note that you can only load disk image at emulator startup. Similarly, you can not remove a simulated SD card from a running emulator. However, you can browse, send files to, and copy/remove files from a simulated SD card either with adb or the emulator.

The emulator supports emulated SDHC cards, so you can create an SD card image of any size up to 128 gigabytes.

While Android will unmount the SD card, the emulator process keeps the backing file open.

$ ls -go /proc/`pidof emulator`/fd | grep sdcard.img lrwx------ 1 64 2010-05-13 01:50 10 -> /home/x/.android/avd/WithSD.avd/sdcard.img 

Someone more familiar with QEMU may be able to provide further insight but, if I were you, I would just try to use NFS to solve this problem.



回答2:

I tried going to Settings and unmounting the SD card and this worked fine. Give it a try; remounting it is quite simple.

Doesn't seem like this can be done via adb/cli though.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!