Running Mobile Automation Scripts with Android Emulators on top of linux Docker containers

We are currently trying to run Android mobile automation scripts on top of dockers with ubuntu as base image , so i created need a dockerfile with the below configurations :

Android Studio: Android Studio Dolphin | 2021.3.1 Patch 1
Appium: App Version 1.19.1
Node.js: v18.12.1
Java: openjdk 17.0.2 2022-01-18 LTS
OpenJDK Runtime Environment Corretto-17.0.2.8.1 (build 17.0.2+8-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.2.8.1 (build 17.0.2+8-LTS, mixed mode, sharing)
Python: 3.10.5
RobotFramework

Below Are the configuration which we have used to create the AVD

hw.ramSize=4096
vm.heapSize=1024
image.sysdir.1=system-images/android-33/google_apis/x86_64/
hw.internalStorage.path=/root/.android/avd/Incident_AVD.avd/sdcard.img
hw.internalStorage.size=16384MB
sdcard.size=16384MB

And copied our mobile scripts which are based on Robotframework into the container

While running the dockerfile , i am getting the below error

Waiting for emulator to start…
INFO | Storing crashdata in: /tmp/android-unknown/emu-crash-34.2.14.db, detection is enabled for process: 58
INFO | Android emulator version 34.2.14.0 (build_id 11834374) (CL:N/A)
INFO | Found systemPath /opt/android-sdk/system-images/android-33/google_apis/x86_64/
INFO | Storing crashdata in: /tmp/android-unknown/emu-crash-34.2.14.db, detection is enabled for process: 58
INFO | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
INFO | Increasing RAM size to 2048MB
WARNING | File System is not ext4, disable QuickbootFileBacked feature
ERROR | x86_64 emulation currently requires hardware acceleration!
CPU acceleration status: KVM requires a CPU that supports vmx or svm
More info on configuring VM acceleration on Linux:

General information on acceleration: Configure hardware acceleration for the Android Emulator  |  Android Studio  |  Android Developers.
Emulator not found. Exiting…

Q&A:

I am currently running this docker on an T3a.large

I have reached a bit on running the android emulators on linux dockers , Is there any way we can bypass this hardware acceleration and run the tests as iam ok to take a hit on performance.

Is it must that we need hardware acceleration to run this on *86-64 architecture .

Thanks

Well, looks like you are trying a very complicated setup.

If the error says it needs hardware acceleration then it must.
In my PC it needed, and Android Studio installs a driver for it.
Did you manage to run Android Emulator in docker? That is the first step to solve, and I would experiment first in a normal PC.

Also I don’t know if this is relevant:

WARNING | File System is not ext4, disable QuickbootFileBacked feature

Maybe you should have the same operating system as in T3a.large, as the base Docker image.

Good luck

1 Like