Android模擬器可以讓咱們使用fat32格式的磁盤鏡像做爲SD卡的模擬:android
如下全部操做均在windows環境windows
首先,運行cmd,進入命令行界面(須要預先將你放置android sdk所在目錄下的tools設置到環境變量path中)瀏覽器
如下除eclipse方式,其餘均在命令行運行eclipse
1. 建立SD文件google
命令行方式: mksdcard 512M sdcard.img 這樣就在當前目錄下就建立了一個512M的SD卡鏡像文件spa
mksdcard參數以下:插件
mksdcard: create a blank FAT32 image to be used with the Android emulator命令行
usage: mksdcard [-l label] <size> <file>3d
if <size> is a simple integer, it specifies a size in bytesip
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
2.在模擬器中加載剛建立的SD文件
//命令行方式:emulator -sdcard d:/android/mysdcard/sdcard.img
eclipse方式:(前提是安裝了google android 插件), 選擇菜單「Run」 -> "Run Configurations..." ,進入彈出頁面,選擇"Targets"標籤,在最下面一行"Aditional Emulator Command Line Options"下面增長啓動參數 -sdcard d:/android/mysdcard/sdcard.img
3.向SD卡傳輸文件(管理SD卡上的內容)
能夠用mtools來作管理,也能夠用android SDK帶的命令:
adb push local_file sdcard/remote_file
local_file表示要傳輸的文件絕對路徑,或與Tools目錄的相對路徑
remote_file爲Qemu中Linux目錄/sdcard/文件名
eclipse方式:
經過DDMS標籤中的File Explorer文件瀏覽器在傳輸
經過eclipse建立就簡單的多了,直接在創造avd的時候即在window的下拉列表中選擇android AVD Manager的create AVD哪裏輸入建立的name,target,sdcard輸入要建立的虛擬sd卡的大小
點擊create avd--finish便可