How to use Android emulator via VNC
Asked Answered
C

2

9

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.

Carnelian answered 20/10, 2012 at 20:14 Comment(1)
Why not use one of the several VNC apps in the Play store? For the server being reachable from the outside world, you would have to setup the emulator network properly though (bridging or NAT, maybe in combination with a tunnel).Lowspirited
M
7

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.

Misdirect answered 30/12, 2013 at 12:8 Comment(0)
L
0

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.

Longhand answered 22/5, 2015 at 12:52 Comment(2)
shouldn't it be export DISPLAY=2?Cross
Corrected it, @Leibovich. Thanks.Grisgris

© 2022 - 2024 — McMap. All rights reserved.