Android - Transfer data from desktop to an emulator
1. Using command line: Here's how you can copy files to an SD card image.
You have to use adb push
to copy files from Desktop to Emulator and adb pull
for the reverse. Here's the syntax to copy files to or from an Emulator/Device Instance:
Copy from desktop to emulator:
adb push <local> <remote>
Copy from emulator to desktop:
adb pull <remote> <local>
Here <local>
is path of file / folder on your desktop and <remote>
is path of file / folder on your emulator.
Here is an example:
adb push foo.txt /sdcard/foo.txt
foo.txt will be pushed (copied) to the emulator.
2. Using DDMS UI: Here's how to work with emulator's file system using DDMS.
- 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.
I personally prefer the adb pull and adb push commands as you can copy multiple files (in a single directory) with just one line command, using DDMS you can copy only one file at a time (no directory).