I'm using a VNC client (Remmina) to connect to an Android Emulator running in a Docker container, and it worked with APIs from 19 to 27, but 28 errors when using with the VNC option (but works without VNC):
qemu-system-x86_64: VNC supports only guest GPU, add "-gpu guest" option
My environment:
myrepo/app-tools:android-dev-1.0.2
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND noninteractive
RUN echo "debconf shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
echo "debconf shared/accepted-oracle-license-v1-1 seen true" | debconf-set-selections
ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \
ANDROID_HOME="/usr/local/android-sdk" \
ANDROID_VERSION="28" \
ANDROID_BUILD_TOOLS_VERSION="28.0.3" \
GRADLE_VERSION="5.0"
ENV GRADLE_URL="https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
GRADLE_HOME="/opt/gradle/gradle-${GRADLE_VERSION}" \
PATH="/opt/gradle/gradle-${GRADLE_VERSION}/bin:${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools"
COPY android/repositories.cfg /root/.android/
# Download JDK-8 and fix certificate issues
RUN apt-get update \
&& apt-get install -y openjdk-8-jdk \
&& apt-get install -y ant \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/oracle-jdk8-installer \
&& apt-get update \
&& apt-get install -y ca-certificates-java \
&& apt-get clean \
&& update-ca-certificates -f \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/oracle-jdk8-installer
# Download Android SDK
RUN cd /tmp \
&& apt-get update \
&& apt-get install -y nano zip curl net-tools socat \
&& curl -o gradle.zip -L "$GRADLE_URL" \
&& unzip -d /opt/gradle gradle.zip \
&& rm gradle.zip \
&& mkdir "$ANDROID_HOME" .android \
&& cd "$ANDROID_HOME" \
&& curl -o sdk.zip $SDK_URL \
&& unzip sdk.zip \
&& rm sdk.zip \
&& yes | "$ANDROID_HOME/tools/bin/sdkmanager" --licenses \
&& "$ANDROID_HOME/tools/bin/sdkmanager" --update \
&& "$ANDROID_HOME/tools/bin/sdkmanager" \
"build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
"platforms;android-${ANDROID_VERSION}" \
"platform-tools" \
"emulator"
RUN mkdir /main
WORKDIR /main
android/repositories.cfg
### User Sources for Android SDK Manager
#Fri Nov 03 10:11:27 CET 2017 count=0
android-dev.dockerfile
FROM myrepo/app-tools:android-dev-1.0.2
ENV ANDROID_SDK="/usr/local/android-sdk"
ENV PATH="$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH"
RUN /usr/local/android-sdk/tools/bin/sdkmanager "system-images;android-19;google_apis;x86" \
&& /usr/local/android-sdk/tools/bin/sdkmanager --licenses
RUN /usr/local/android-sdk/tools/bin/sdkmanager "system-images;android-23;google_apis;x86" \
&& /usr/local/android-sdk/tools/bin/sdkmanager --licenses
RUN /usr/local/android-sdk/tools/bin/sdkmanager "system-images;android-28;google_apis;x86" \
&& /usr/local/android-sdk/tools/bin/sdkmanager --licenses
RUN /usr/local/android-sdk/tools/bin/avdmanager create avd -n avd19 -k "system-images;android-19;google_apis;x86" -b x86 -d 7 -f \
&& /usr/local/android-sdk/tools/bin/avdmanager create avd -n avd23 -k "system-images;android-23;google_apis;x86" -b x86 -d 7 -f \
&& /usr/local/android-sdk/tools/bin/avdmanager create avd -n avd28 -k "system-images;android-28;google_apis;x86" -b x86 -d 7 -f
COPY scripts/android-dev-startup.sh /root/start.sh
scripts/android-dev-startup.sh
#!/bin/bash
set -eou pipefail
socat tcp-listen:5037,bind=android-dev,fork tcp:127.0.0.1:5037 &
socat tcp-listen:5554,bind=android-dev,fork tcp:127.0.0.1:5554 &
socat tcp-listen:5555,bind=android-dev,fork tcp:127.0.0.1:5555 &
sleep infinity
docker-compose
android-dev:
build:
context: ./
dockerfile: android-dev.dockerfile
hostname: android-dev
volumes:
- .:/main:rw
devices:
- "/dev/kvm:/dev/kvm"
ports:
- "5037:5037"
- "5554:5554"
- "5555:5555"
- "5900:5900"
command: /root/start.sh
Then, if I run the command to start the emulator, it works in all cases except when using the emulator with android-28
(when using VNC):
# works
emulator -memory 4096 -avd avd19 -noaudio -no-window -gpu off -verbose -qemu -vnc :0
# works
emulator -memory 4096 -avd avd23 -noaudio -no-window -gpu off -verbose -qemu -vnc :0
# works
emulator -memory 4096 -avd avd28 -noaudio -no-window -gpu off -verbose -qemu
# doesn't work
# qemu-system-x86_64: VNC supports only guest GPU, add "-gpu guest" option
emulator -memory 4096 -avd avd28 -noaudio -no-window -gpu off -verbose -qemu -vnc :0
# doesn't work
# qemu-system-x86_64: VNC supports only guest GPU, add "-gpu guest" option
emulator -memory 4096 -avd avd28 -noaudio -no-window -gpu guest -verbose -qemu -vnc :0
I think the error comes from this file:
https://android.googlesource.com/platform/external/qemu/+/emu-master-dev/vl.c
Is there a way to make it work with VNC?