Elad Katz - Cool Stories

Monday, May 11, 2009

1st Pico-Post: How to add an SD card to an existing AVD (SDK 1.5 - Cupcake)

Hi, so first things first - what's a pico-post?
well it's basically a cool geeky way of saying a short post - I made it up and hopefully I'll make a few of those every once in a while.
Now for the pico-post itself:
With the shift to SDK v 1.5 the way that the android emulator works has been changed - you can now create several customized AVD's (Android Virtual Devices) that have different properties - this way you can test your app on several types of emulators and simulate different types of display settings etc.
The only problem is that the guys in Android forgot to add an update command to an existing AVD to add an SD card emulation.
This was much easier in the previous version of the API since all you had to do then is create an SD card and then run the emulator with a command line paramater saying - use this card (see here)
But in the new AVD that doesnt work, so we're gonna have to patch it up a bit
so for now here is the guide \ tutorial on how to add an SD card to an existing AVD in android SDK
1- find the path where your avd is stored by running the android list avd command:

$ SDK/tools/android list avd
....
Path: /home/user/.android/avd/myAVD.avd
...

2- create an "sdcard.img" in that directory -- that name is the
default and the emulator will pick it up automatically:

$ SDK/tools/mksdcard 16M /home/user/.android/avd/myAVD.avd/sdcard.img

You can pick any size you want\need for it

Note that "list avd" will not display it after (it only displays what's in the myAVD.avd/config.ini file...) so if you want it to show you can add a line like "sdcard=16M"

That's it.

Thanks to Raphael from the android handset alliance for helping me out on this!

No comments:

Post a Comment