在将要上市的Android手机中外部存储卡必然是MiniSD,那么如何在android模拟器红测试使用SD Card映像呢? 其实在Qemu中就支持外部映像加载的,首先我们进入cmd中使用cd命令定位到SDK的Tools目录下,执行mksdcard命令就可以。
mksdcard参数如下:
mksdcard: create a blank FAT32 image to be used with the Android emulator
usage: mksdcard [-l label] <size> <file>
if <size> is a simple integer, it specifies a size in bytes
if <size> is an integer followed by 'K', it specifies a size in KiB
if <size> is an integer followed by 'M', it specifies a size in MiB
例子: mksdcard -l sdcard 1024M d:/sdcard.img
我们可以看到sdcard image支持FAT32格式,其中usage: mksdcard [-l label] <size> <file>是主要的参数,-l 后面跟的是磁盘卷标,如g就代表g盘,size为制定容量大小,单位有KB和MB。最后一个file参数代表生成的sd映像文件名,如android_sdcard_image
最后我们要说的是如何让Android模拟器加载sd卡映像文件,需要在Eclipse中设置程序的Open Run Dialog框,在Target标签的Aditional Emulator Command Line Options中加入启动参数 -sdcard <sd映像文件名>,如图
如果向sd image中传输文件可以通过:
adb push <sdk的Tools文件夹下文件名> /sdcard/<文件名> 这个命令第一个参数是Android SDK下Tools文件夹中的文件名,而第二个为Qemu中Linux目录/sdcard/文件名。也可以通过Eclipse ADT插件的DDMS标签中的File Explorer文件浏览器在传输如图: