Creating an SD Card file for use between Emulated Devices
In my investigations into the use of the AVD Manager, I've discovered the following about SD Card files. I am sure this stuff is all known to the experts, but I am still a beginner, so I thought I would post this info. I've tried putting it in the Wiki but there are problems there...
One of the options when creating a Virtual Device using the AVD Manager is to allow the use of a file to represent the SD Card. The advantage of this is that the file is not tied to a single Virtual Device, unlike the option to create an SD Card of a specified memory size.
This means that you can share the same SD Card file between emulated devices, although only one can access it at a time.
SD Card - File option
There is a tool provided with the Android SDK which allows you to create SD Card files. They are in FAT32 format.
In order to create a File, you need to use a tool which is provided by the Android SDK, "mksdcard", and a reference to this tool can be found in the Android Documentation
here.
If you want to create a file with a volume name of mySDCard, and a size of 128M, you would follow these steps:
- Open a Command Prompt window from within Windows (on Windows 7, this is found under "All Programs-Accessories-Command Prompt")
- If your path does not contain the Android SDK (which it probably doesn't), you will need to navigate to the folder "C:\Program Files (x86)\Android\android-sdk-windows\tools" using DOS commands.
- Enter "mksdcard -l mySDCard 128M mySDCardFile.img"
This will create a file called "mySDCardFile.img". You can use this as your SD Card file from within the AVD Manager.
As an interesting aside, for Mac users there is the added bonus that you can mount this image file on your Mac desktop and it will appear as a drive to which you can add or delete files as required.
Note that when the image file is in use, it is locked, so you can't edit files from the Mac O/S while it is in use inside an active Virtual Device. You have to close the Virtual Device first. Similarly, when the Mac O/S has the image file mounted, you won't be able to use it in a Virtual Device.
I've not found an equivalent way of accessing the image file in Windows yet.