Sunday, October 25, 2009

Create SD Card in Android Emulator and copy files into, in Eclipse, Emulator and DDMS.

In my previous articles, I described how to Create an SD Card to existing AVD, and Copying Files to a Disk Image in ubuntu host system using text commands in Terminal.

Now, I have another approach using in Eclipse, Emulator and DDMS. May be it's more easy, at least no need to remember the text commands.

Create a new AVD in Eclipse:

- Start Eclipse, click Window on the top menu, and click Android SDK and AVD Manager.

- New a AVD

- Name your new AVD, select Target, type 1000M in SD Card and select skin. Click Create.
note: SD Card must be either a file path or a size such as 128K 0r 64M. type 1000M now to create a SD Card of 1G.

- Select and Start the new AVD.

After the Emulator started, you can close the AVD Manager.

Create folder in SDCard

I can't find any File Manager in Android Emulator. Fortunately, Android Emulator provide a DevTools with Terminal, so you can create a folder using Linux command inside Android Emulator.

- Click the ARROW on the screen to display the available application.

- Click DevTools.

- Scroll down to start Terminal Emulator

- It's the same a terminal in Linux, you can ls to view the current files and folders in your $home.

- Now change into sdcard and create a folder, say pictures.
$cd sdcard
$mkdir pictures

It's the only two line of command in this approach.

Copy files from your host system into Android SDCard

- With the Emulator is running. Now go back to Eclipse, switch to DDMS Perspective

Click the arrow on the menu bar and select DDMS


Click Window > Open Perspective > others > to select DDMS

- Select the device in the window on the left, eg. emulator-5554.
(Without select the device, you will fail in copying files into.)

- In DDMS, select File Explorer tag in the window on the right. Expend sdcard folder. Now, you can see the pictures folder in the tree. And also, you can see the Permissions of the folder.

- Select the pictures folder, and click Push a file onto the device .

- Browse to and select the files from your host, to push onto the Android Emulator.

- Further expend the folder pictures, you can see the new file here.

Related article: How to create sub-folder in SD Card of Android Emulator, using adb


Unknown said...

i have tried to find how to copy file to SDcard in android emulator.

so far i couldn't...

but your description is the art.

very appreciate it.

have a nice day...^^

New Android Developer said...

I tried to createa folder in sdcard, it says permission denied.

Any help is appreciated.

New Android developer.

Dan Capshaw said...

Thanks for the help.

Erik said...

Hello New Android Developer,

How to create sub-folder in SD Card of Android Emulator, using adb:

How to create sub-folder in SD Card, using Java code:

Unknown said...

i'm done push picture to device. but when i open gallery on the emulator, the picture that i've transfered didn't show up. can you help me?.

Erik said...

hello Dony,

I tried in my emulator running 2.2.

You have to un-mount & munt SD Card: Android HOME -> MENU button -> Settings -> SD card & phone storage -> Unmount SD card and then Mount SD card.

Such that Emulator re-search files in SD Card.

VINEETHPV87 said...

hey dony after pushing a file you need to run mediaScanner(which can be found in Dev tools) such that emulator re-scans sdcard files...then open gallery

Anonymous said...

I have tried your approach it showing mkdir failed for pictures, permission denied. what mistake i have done can anyone please help for this


Unknown said...

install astro file manager.u can do any thing

Jitendar said...

Thanks a lot for the procedure..

Ionut Pirvulescu said...


for those who have the permission denied problem ... i've fixed adding "sd card support on yes" under the hardware properties on your android virtual device
follow this link for the picture:

sharath said...

hey wen i try to create a folder i am getting error as permission denied

Unknown said...

While me too had the "permission denied" error from terminal, on latest Eclipse I found the "Create Folder" right on side to the "push file" button. Used that and workd fine :)

dhara said...

when i am creating folder in sdcard...i got permission denied...n i didnt find "sdcard support???