Creating custom SD card in Android emulator 3

The android sdk comes with a tool sdcard to create SD card file to be used with the Emulator.  In order to create a sdcard we need to go to the directory where android sdk tools are installed from command prompt (generally it is C:\android\android-sdk-windows) it can be done in two ways

  • Open a command prompt to open it press ctrl+r then type cmd in the new dialog box & click enter and manually traverse to that directory.

                                                                                           OR

  • Go to directory where android sdk tools is installed and select tools folder, directly open command prompt at  that location by pressing shift button and holding it and then right clicking & selecting option open command window here.

Opening cmd directly at desired location

This is how your cmd should look like

Type the following command

mksdcard100M d:/sdcard

where

mksdcard :- is the command to create sd card.

100M  :- is the size of sdcard(which can be changed according to our requirement)

D:\   :- is the location where sdcard is created

sdcard:- is the name of sdcard which can be modified as per our wish

it may take few second depending upon size of sdcard, after this you will find a a image file with name sdcard in the location which you have created (D: in mycase).

 

ASSIGNING THE SDCARD TO EMULATOR

Now in eclipse in top menu Run>Run configuration

  • Select target tab
  • At the bottom of the window there is a field Additional Emulator command line options
  • Type -sdcard followed by path of folder in which sdcard was created (don’t forget to write the name of your sdcard at the end of the path as in my case complete command is  –sdcard D:\sdcard ).

Adding SD card to emulator

  • Now hit the apply button at the bottom and close the dialog box.
  • Close the emulator if it was open and run it again .
  • If we run our app again nothing interesting is going to happen with your app :-) .

Now we need to push some data into our sdcard before we can use it

PUSHING DATA INTO THE  SDCARD

In the eclipse from the main menu select window>show view>file Explorer can also open File Explorer by choosing DDMS view which contains File explorer

Selecting DDMS

  • Inside your file explorer select “push a file onto the device
  • But beware u cannot push data in any file because many of file are read only there.
  • So to push file goto mnt/sdcard and push your data here.

To push data click on “push a file onto the device” and then drag and drop the file into the selected folder

Selecting push files to sdcard

NOTE :- Sometime it may not show file after pushing in that case you need to just restart eclipse as well as emulator.

  • Sanjay

    i m facing a problem on sd card creation using cmd   

    on writing 
    mksdcard100M d:/sdcard  , i got Could not create file  
    d:/sdcard   :Permission deniedeven i run cmd as administrator . 

  • michael

    I suggest you to change the permissions for the folder where you want to create your sdcard and allow full access for the user account by which you are  logging into your system. This screenshot may be of some help to you, also the syntax for creating sdcard is “d:” not “d:/”

  • Pingback: android emulator with SDcardJisku.com | Jisku.com

Join The Geek Side

Recommend on Google