Tag: sdk

Android – Transferring files between emulator and the computer

Here is  a very useful tutorial for who needs to copy files between Android emulator and your PC.

There are some ways to transfer file from PC to emulator and from emulator to PC. I will show up two ways.

Using Eclipse plugin – ADT

Runs Android’s emulator. Click in the button “Opens the Android Virtual Device Manager” at Eclipse’s menu.

Select your device and click “Start”.

Wait until the emulator boot.

Back to Eclipse, opens “File Explorer” view clicking in Window > Show View, Other…

Select Android > File Explorer.

The tab “File Explorer” will show up.

Copying files from PC to emulator

Select the directory where you want to put the file and click button “Push a file onto the device” ().

Select the file and wait for the end of process.

Copying files from emulator to PC

Be sure the emulator still running, in the tab “File Explorer”, select files that you want to copy to PC and click buton “Pull a file from device” ().

Choose where to put the file.

Using MS-DOS Prompt (Windows Command Line)

We’ll not use Eclipse IDE, only the tool available in Android SDK and MS-DOS Prompt.

Open up “Android Virtual Device Manager” running “AVD Manager.exe”, available in Android SDK instalation directory.

Choose your device in the lista and click “Start”.

Wait until the emulator boot and open MS-DOS Prompt.

Type command:

<ANDROID-SDK-DIRECTORY>/platform-tools/adb devices
Replace “<ANDROID-SDK-DIRECTORY>” by path of installation of Android SDK.

A list, with attached devices, will show up:

List of devices attache
emulator-5554   device

Connect the ADB to emulator using the command

<ANDROID-SDK-DIRECTORY>/platform-tools/adb connect localhost:5554
The number “5554” is the same displayed  at description “emulator-5554” and at emulator’s title bar .

The line “connected to localhost:5554” will be displayed.

Copying files from PC to emulator

To send file located in directory of your PC to emulator, all you need to do is type

<ANDROID-SDK-DIRECTORY>/platform-tools/adb push text.txt /sdcard
You can replace the argument “/sdcard” by internal path where you want to put the file in emulator

Wait util copy end and done! The file was copied to emulator.

Copying files from emulator to a directory in your PC

If you wants to get a file from and put it in your PC, type the command bellow:

<ANDROID-SDK-DIRECTORY>/platform-tools/adbadb pull /sdcard/text.txt <DESTINY-PATH>
Replace “<DESTINY-PATH>” by complete path where you want store the file

Done! The file was copied again to your PC.

Installing .apk packages at Android SDK emulator

Sometimes our applications depends of third-part applications for tests or to access resources of emulator that aren’t available by default.

In directories of SDK, commonly in platform-tools, there is an executable called adb, with it we’ll to install third-part applications.

You will need an application (.apk). Browse internet or copy from your Android smartphone using applications like AppSaver.

– Run the emulator, you can use SDK Manager or Eclipse plugins.

– Using DOS Command (Windows) or terminal (Linux), open directory platform-tools and run commando line below:

$ adb install <.apk path>

This message will be displayed

$ adb install Application.apk
125 KB/s (1091937 bytes in 8.474s)
        pkg: /data/local/tmp/Application.apk

Now, the third-part application is available at emulator menu, like have installed in your smartphone.

Agora o aplicativo estará disponível no menu do emulador. 😉


  • Advertisement

  • Advertisement

  • Copyright © 1996-2010 André L. S.. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress