TRANSFERRING FILES INTO AND OUT OF THE EMULATOR

Occasionally, you may need to transfer files into or out of the emulator. The easiest way is to use the DDMS perspective. From the DDMS perspective, select the emulator (or device if you have a real Android device connected to your computer) and click the File Explorer tab to examine its file systems (see Figure B-25).

The two buttons highlighted in Figure B-25 enable you to either pull a file from the emulator or push a file into the emulator.

Alternatively, you can also use the adb.exe utility shipped with the Android SDK to push or pull files to and from the emulator. This utility is located in the <Android_SDK_Folder>\platform-tools\ folder.

To copy a file from the connected emulator/device onto the computer, use the following command:

      adb.exe pull /data/app/<filename> c:\
image

NOTE When using the adb.exe utility to pull or push files from or into the emulator, ensure that only one AVD is running.

Figure B-26 shows how you can extract an APK file from the emulator and save it onto your computer.

To copy a file into the connected emulator/device, use the following command:

adb.exe push NOTICE.txt /data/app ...

Get Beginning Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.