Search code examples
androidandroid-emulatorsd-cardandroid-sdcard

how to hack a real SD card in android emulator? (via USB card reader)


i know that emulator can create a sdcard.img as a device for emulator use.

but now, i want to use a real SD card in android emulator. Is it possible that i build android emulator in windows environment or this request need to implement in Linux environment?

any idea is welcome. thanks.


Solution

  • OK, finally I got the answer by myself...

    first thing we occured in this issue is got below warning when execute emulator.

    WARNING: SD Card files must be at least 9MB, ignoring /dev/sdX

    after traced the source code in main.c,

       if (size < 9*1024*1024ULL) {
               fprintf(stderr, "### WARNING: SD Card files must be at least 9MB, ignoring '%s'\n", opts->sdcard);
            } else {
                hw->hw_sdCard_path = ASTRDUP(opts->sdcard);
            }
    

    I ignored the if condition, i.e. force execute hw->hw_sdCard_path = ASTRDUP(opts->sdcard);

    then, everything go right:)