Create and use emulated SD Card
SD card is an external storage for mobile device, by default, it is not available in Android Emulator. What you need to do is to create an emulated SD card for your Android Emulator.
1. Creating SD Card
Access to your Android SDK Tools folder and use command “mksdcard” in order to create one.
By default installation on Windows, the Tools folder should be here:
Using following syntax to create your desired SD Card
mksdcard [memory size] [output file]
For example, I’d like to create a SD card with 256 MB in memory and put the files in C:\Personel\AndroidNewbie\SDCard with file named “sdcard_dev.iso“, I do like this:
mksdcard 256M C:\Personel\AndroidNewbie\SDCard\sdcard_dev.iso
2. Using SD Card
You’ve done creating your desired SD Card, now you need it to be used by Android emulator. Open Eclipse, access to your project.
On menu Run -> Run Configurations, click on Android Configuration on the left tree menu, click on tab Target on the right pane. You will see at the bottom: “Additional Emulator Commandline Options” and an Input/Edit box below:
Just type your input sdcard following syntax
-sdcard [sdcard location]
For example, with the SD Card I’ve created above, I type:
Now just run your emulator, you can access to your created SD Card.
Another way to run your Emulator with SDCard:
+ Open AVD Manager, click on the device you want to run with SDCard automatically, click on button Edit on the right menu. A setting dialog appears and just browse to your desired SDCard image:
3. Browse SD Card
There are many ways to browse SD Card, however, I will just tell you two common ways:
a. In Eclipse, open DDMS Perspective, and open File Explorer view, you can browse /sdcard directory.
In this mode, you can drag and drop files.
b. Using commandline, go to adb shell by typing:
adb -e shell
Then access to /sdcard directory by typing:
# cd /sdcard
You can use push/pull from adb shell to put files into sdcard or get files from it.
It’s quite handy-some, isn’t it?