Connect to Android Emulator in a Docker Container through VNC (error with API 28) Connect to Android Emulator in a Docker Container through VNC (error with API 28) docker docker

Connect to Android Emulator in a Docker Container through VNC (error with API 28)


I found something interesting in the output of the emulator-headless:

emulator: WARNING: Your AVD has been configured with an in-guest renderer, but the system image does not support guest rendering.Falling back to 'swiftshader_indirect' mode.emulator: GPU emulation enabled using 'swiftshader_indirect' modeemulator: Initializing hardware OpenGLES emulation support

https://androidstudio.googleblog.com/2018/11/emulator-28016-stable.html?m=1

-gpu guest (software rendering in the guest) has been deprecated. API 28+ system images will now auto switch to using Swiftshader (-gpu swiftshader_indirect).

So it switches to swiftshader_indirect, which makes it unable to use vnc. Uh oh.

So now I wonder if one can use environmental variable DISPLAY to make emulator-headless render the graphics into virtual display that one will create with some another VNC server...

Edit:Yes, it seems to be working well on 2 Xeon cores 3.3Ghz each and 4GB RAM.

echo 'no' | avdmanager create avd --force --name android-28-x86 --abi google_apis_playstore/x86 --package 'system-images;android-28;google_apis_playstore;x86'apt install tightvncapt install xfonts-basesudo apt-get install gnome-core xfce4 firefox nano -y --force-yes# ~/.vnc/xstatupunset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS startxfce4 & [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic &vncserver :2 -geometry 1080x1920 -depth 24export DISPLAY=:2.0emulator @android-28-x86 -verbose -memory 2048 -gpu swiftshader_indirect -no-audio -no-snapshot -wipe-data -no-boot-anim -skin 768x1280

I still have no idea why the android emulator developers decided to disable vnc support in their product if everything works well with gpu software emulation on standalone vnc server..?

Edit2:It always loads CPU 100% though. Apparently it requires a fix. https://gist.github.com/yazinsai/652f0e6e77c9594a2356dd6314a9c3d8LMK if you want to implement it.