(re)mounting the SD card on android emulator

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

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

  • FFMPEG for Android toolchains: arm-linux-armeabi-eabi-pkg-config - is there any toolchain in existence containing the pkg-config tool
  • The GestureDetector does not work (example from android developer)
  • How can I disable all views inside the layout?
  • Card.io Does not scan non - Raised Digit Credit Cards
  • ViewDragHelper: how to use it?
  • Android: Is it better to create a new fragment every time a navigation drawer item is clicked, or load up previously created fragments?
  • 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

    Related posts:

    Is this the right way to clean-up Fragment back stack when leaving a deeply nested stack?
    Android's viewDidLoad and viewDidAppear equivalent
    Android/java Sqlite: How to retrieve max datetime?
    Intent - if activity is running, bring it to front, else start a new one (from notification)
    Finalizing a Cursor that has not been deactivated or closed non-fatal error
    SQLite Exception: no such table Error
  • Best practice to reference the parent activity of a fragment?
  • How to prevent conflict animation with device rotation in android?
  • Enabling Location mode High Accuracy or Battery saving, programmatically, without user needing to visit Settings
  • How to implement button in ViewPager?
  • Branch.io deeplink in android opens Play Store even no matter what
  • imeOptions “actionNext” programmatically - how to jump to next field?
  • 2 Solutions collect form web for “(re)mounting the SD card on android emulator”

    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.

    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.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.