how to import files into the sdcard on emulator in android?
i want to load some photos into my sd card im开发者_JS百科age in the emulator. how to do this by command prompt.how to do that?
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.
I've just found out how to add some files in the SD card image.
- Turn all running emulators off but keep Eclipse on.
- Using thecommand line, start the ddms tool. ddms
- Now start stand-alone emulator console. emulator -avd myAVDname -sdcard mysdcard.img
- Push a file into the sdcard. adb push yourfilename /sdcard/
- You should get a message (how much memory it occupies)
- 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!
On Android Studio
- Run Emulator
- open android device monitor
- scroll down and select sdcard
- Click on Push file into sdcard icon at top right
- choose the file Hope this helps..
in Eclipse, Open the DDMS Perspective.
Start an Emulator. Select it in the Devices.
Click on the File Explorer Tab in DDMS.
THEN THE FOLLOWING DOCUMENTATION FROM OFFICIAL ANDROID WEBSTIE: http://developer.android.com/tools/debugging/ddms.html
Working with an emulator or device's file system
DDMS provides a File Explorer tab that allows you to view, copy, and delete files on the device. This feature is useful in examining files that are created by your application or if you want to transfer files to and from the device.
To work with an emulator or device's file system:
In the Devices tab, select the emulator that you want to view the file system for. To copy a file from the device, locate the file in the File Explorer and click the Pull file button. To copy a file to the device, click the Push file button on the File Explorer tab.
Answer here also. You need not open cmd when using eclipse.
Problems trying to push files into android device using eclipse
You can use the ADB via a terminal to pass the file From Desktop to Emulator.
adb push <file-source-local> <file-destination-remote>
You can also copy file from emulator to Desktop
adb pull <file-source-remote> <file-destination-local>
first,download magiciso(http://www.magiciso.com/Setup_MagicISO.exe)
after downloading When your emulator is not open go to your avd files(c:/document and settings/"user name"/.android)
there is your avd named folder
then open sdcard.img with magiciso
now you have to drag and drop files in your magic iso window
don't forget to save the file
精彩评论