Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to import files into the sdcard on emulator in android?

i want to load some photos into my sd card image in the emulator. how to do this by command prompt.how to do that?

like image 745
Praveen Avatar asked Mar 24 '10 09:03

Praveen


People also ask

How do I put files on my Android emulator?

Then you can navigate to folder which you want to push your file in it. Right click on that folder and select upload(or press Ctrl + Shift + O ). Select file you want to upload and it will upload file to desired location.

How do I get files from an emulator?

To copy a file from the connected emulator/device onto the computer, use the following command: adb.exe pull /data/app/<filename> c:\ NOTE When using the adb.exe utility to pull or push files from or into the emulator, ensure that only one AVD is running.

Where does the Android emulator store files?

The android tools create an . android folder in your users home folder. This folder contains an avd folder in which a separate folder for each virtual device exists. In each of this folders a file called sdcard.


2 Answers

I've found it to be incredibly clumsy and not work very well, but the command to use is: adb push yourfile.xxx /sdcard/yourfile.xxx. For this to work you've got to have the file in the same directory as adb.exe, which is in the tools folder of your SDK directory, or have set up adb as a system-wide recognisable command. (I don't remember how to do that, but I know it can be done). This also assumes you've set up an SD card through the AVD manager. However, the problem I faced when doing this is that sometimes the file would appear on the emulator with a size of 0 bytes. What I mean is that I could see the file in the DDMS file browser in Eclipse, but after doing the necessary emulator restart, the files would then be shown with the 0 byte size. I couldn't find a pattern on why that happened, but trying a few times in a row eventually worked.

like image 71
Steve Haley Avatar answered Oct 19 '22 08:10

Steve Haley


I've just found out how to add some files in the SD card image.

  1. Turn all running emulators off but keep Eclipse on.
  2. Using thecommand line, start the ddms tool. ddms
  3. Now start stand-alone emulator console. emulator -avd myAVDname -sdcard mysdcard.img
  4. Push a file into the sdcard. adb push yourfilename /sdcard/
  5. You should get a message (how much memory it occupies)
  6. In Eclipse, you will see the folders (including SD card and the files you just add) appear.

For me, the files didn't appear at the first time in File Explorer, then I closed the emulator and turned it on again. Now it works!

like image 44
npittaya Avatar answered Oct 19 '22 08:10

npittaya