white_gecko
white_gecko

Reputation: 5086

How to use Android emulator via VNC

I want to provide access to an Android emulator via VNC to let people test my App.

So far I could start the Android emulator with following command:

emulator -avd ice -verbose -qemu -vnc :2

I could also connect to it at port 5902 but I can't do any input, I don't know how to forward my mouse to the qemu.

Upvotes: 9

Views: 13175

Answers (2)

motobói
motobói

Reputation: 1805

You can achieve this by starting a vnc server on your machine on display :2, informing android emulator to use this display and start the emulator:

vncserver :2 -geometry 1080x1920 -depth 24
export DISPLAY=2
emulator -avd avd_name -qemu

There are several vnc servers for Linux. I recommend tightvnc (package tightvncserver on Ubuntu).

vncserver will probably run your xstartup script located at folder .vnc on your home folder. If you don't want that, just comment all lines on this file (deleting the file won't help).

geometry should be screen dimensions of your avd. And it should have no skin.

Upvotes: 0

naizheng TAN
naizheng TAN

Reputation: 167

I guess the parameter "-qemu -vnc" will not work for android emulator's input. There are two hints: (1) the "-vnc" parameters are directed to qemu instead of android-emulator, and qemu-vnc may not support android's inputs (2)the VNC protocol does not define the "drag"/"move" which is a common operation for mobile.

However, there is a solution for your requirement:

  1. Shut down the display of the emulator (optional) by using:

    emulator @avd -no-window

  2. Install a vnc server. I recommend fastdroid-vnc, which is pretty good. (https://code.google.com/p/fastdroid-vnc/)

In this way, your emulator display is just like the effect of "-qemu -vnc :2" with inputs. BTW, the "drag" is still not working.

Upvotes: 7

Related Questions