2012-08-11

Use the Android AVD in another computer

Using a computer for a long time, you may be preferred it or may be accustomed to it.  During developing the Android App, always start the emulator to test the program.  But, if your old computer is not good enough to execute the simulator, buy a new computer for this reason is a bit costly.  Of course, you can use a Android-x86 PC or a physical Android device.  you need to use the Android emulator (AVD), if you are developing an App using the Google API.

Can I use the AVD in another computer to test App? Of course!

Note: The following procedures only testes successfully in the environment of two computers running Linux.  These procedures have not yet been tested in Windows system.

1. Install the Android SDK on the "remote computer"

Refer to the document, "HOWTO Setup Android Development", to install the Android SDK in another fast Linux computer.

2. Establish the "terminal" connection between "Local Computer" and "remote computer"

Use SSH to establish the link between the "local computer" and "remote computer".  The command in the "Termial" is
[SiB@Celeron-D ~]$ ssh 192.168.10.17 -p 2012 -L 5555:127.0.0.1:5555 -X
where "192.168.10.170" is the network address of the "remote computer", "2012" is a "remote computer" in the SSH port number and two "5555" are the AVD corresponding port number for the "local computer" and "remote computer".  The parameter "-X" is more important.  It will redirect the screen of AVD running on the "remote computer" to "local computer".
  When the connection is successful, the Terminal command prompt will change as "remote computer" prompt text.
[SiB@Celeron-D ~]$ ssh 192.168.10.17 -p 2012 -L 5555:127.0.0.1:5555 -X
SiB@192.168.10.17's password: 
Last login: Sat Aug 11 12:32:21 2012 from 192.168.10.12
[SiB@Core-i7 ~]$
In this example, the "Terminal" screen contains the command prompts of the two computers: "local computer" for "[SiB@Celeron-D ~]" and "remote computer" for "[SiB@Core-i7 ~]".

3. Start the AVD in "remote computer"

Before start the AVD in "remote computer", we test the AVD connection status of ADB in "local computer" firstly.
[SiB@Celeron-D ~]$ Android-SDK/platform-tools/adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
 
Sure there are no any the AVD connection.  Then, start the AVD in the "remote computer", it can only use the command mode,
[SiB@Core-i7 ~]$ Android-SDK/tools/emulator -avd Android_2.2
Failed to create Context 0x3005
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
emulator: warning: opening audio output failed
These "warning messages" do not affect the subsequent operation. Then, the familiar picture is appeared.
Of course, it is shown on the screen in "local computer".

4. Use the ADB in "local computer" to connect AVD

Then test the AVD connection status of ADB in the "local computer".
[SiB@Celeron-D ~]$ Android-SDK/platform-tools/adb devices
List of devices attached
 
Strange!  Does not the AVD in "remote computer" have been started and the screen have been redirected to the "local computer"? It is not enough.
  The ADB in "local computer" must be restarted to search for the network-connected AVD again.
[SiB@Celeron-D ~]$ Android-SDK/platform-tools/adb kill-server
[SiB@Celeron-D ~]$ Android-SDK/platform-tools/adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
This means that the ADB in "local computer" is restarted successful.  Then, the AVD connection status of the ADB in "local computer" is tested again.
[SiB@Celeron-D ~]$ Android-SDK/platform-tools/adb devices
List of devices attached 
emulator-5554 device
The screen shows the detected AVD and the connection message.  Of course, the AVD is running in the remote computer.

5. Test and debug the App using the AVD in the "remote computer"

Finally, we don't need replace the preferred computer, and continue to enjoy the fun of the development.

Tested version:

  • Fedora: 14, 17

No comments:

Post a Comment