Thursday, July 30, 2009

How to Create SD Card?


The following commands will create, mount the SD card and finally push the songs to the SD card and emulator playing those songs/pictures.
  1. C:\android-sdk-windows-1.5_r3\tools>mksdcard -l sd500m 500M C:\android-sdk-windows-1.5_r3\tools\mysdcard.img ...... mksdcard: create a blank FAT32 image to be used with the Android emulator
    usage: mksdcard [-l label]

    if is a simple integer, it specifies a size in bytes
    if is an integer followed by 'K', it specifies a size in KiB
    if is an integer followed by 'M', it specifies a size in MiBto create sdcard

  2. The following size file will be created in tools directory of android-SDK. You can also create SD card with any memory size - say, 256M, 512M, 1024M, 2048M.

  3. To mount on emulator without specifying -avd C:\android-sdk-windows-1.5_r3\tools>emulator -sdcard mysdcard.img
    emulator: ERROR: You did not provide the name of an Android Virtual Device
    with the '-avd ' option. Read -help-avd for more information.

    If you *really* want to *NOT* run an AVD, consider using '-data 'to specify a data partition image file (I hope you know what you're doing). However, this command will work fine with android-sdk-windows-1.0_r1 (as in my previous post).
  4. The correct command to mount SD card is on latest android version is ..... C:\android-sdk-windows-1.5_r3\tools>emulator -sdcard mysdcard.img -avd opus29

  5. However, if, the emulator instance is already running, it gives the following error: emulator: ERROR: the user data image is used by another emulator. Aborting (so close the running emulator and then type again the following command).
  6. C:\android-sdk-windows-1.5_r3\tools>emulator -sdcard mysdcard.img -avd opus29 (this will run the new emulator instance with the SD card on it).
  7. To push songs on the emulator using Eclipse->Window->Open Perspective->Other->DDMS

  8. Choosing DDMS.

  9. the DDMS dialog box opens up ... on right side, we have tabs like @File Explorer ... there is sdcard folder with d--rxrwx permissions.
  10. Drag and Drop the audio / music files and picture files to this card with all the extensions like .wma, mp3, etc.

  11. This is how it looks finally in SDcard.

  12. Play files on the emulator. However if you have problems running any files on emulator, try to re-run the instance of the emulator after closing using the same command C:\android-sdk-windows-1.5_r3\tools>emulator -sdcard mysdcard.img -avd opus29.

  13. This is how the picture folder will look like.


  14. Follow the following steps have to be redone if you have changed the version of android SDK and not updated eclipse. http://developer.android.com/sdk/1.5_r3/upgrading.html



1 comment:

Pat said...

Thank you for the article.