We are currently trying to run Android mobile automation scripts on top of dockers with ubuntu as base image , so i created 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
Installed required depedencies
RUN npm install -g appium@latest @appium/doctor &&
appium-doctor --android &&
appium driver install uiautomator2 &&
appium plugin install execute-driver &&
appium plugin install images &&
appium plugin install relaxed-caps
And also installed required SDK tools
RUN wget -O /tmp/sdk-tools-linux.zip https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip &&
mkdir -p /opt/android-sdk/cmdline-tools &&
unzip -d /opt/android-sdk/cmdline-tools /tmp/sdk-tools-linux.zip &&
rm /tmp/sdk-tools-linux.zip
And i have included the Android system image for QEMU *86_64
RUN mkdir -p /root/android/system-images &&
wget -O /root/android/system-images/android-33-google_apis-x86_64.zip \
And copied our mobile scripts & required APK’s which are based on Robotframework into the container
We were sucessfully in getting the test case pass(robotframework) by spinning the android emulator using SDK tools .
However we would need to replicate the scenario by using QEMU , So instead of spinning the android emulator from SDK tools we can use QEMU to do it .
I am unable get the QEMU emulator up to run trh scripts , Our ultimate goal is to Work on using a newer light-weight emulator (QEMU) that will avoid any infrastructure changes required for the scripts to run. This facilitates usage of AWS serverless compute engine Fargate.
I am unable to boot the emulator using QEMU , I am manually starting the ADB server & appium server using adb start-server --port=5037 however the ADB server is not getting started .Below is the error which iam coming across
Error :
- daemon not running; starting now at tcp:5037
- daemon started successfully
[Appium] Welcome to Appium v2.11.1
[Appium] Non-default server args:
[Appium] {
address: ‘127.0.0.1’,
basePath: ‘/wd/hub’
}
[Appium] The autodetected Appium home path: /root/.appium
[Appium] Attempting to load driver uiautomator2…
[Appium] Requiring driver at /root/.appium/node_modules/appium-uiautomator2-driver/build/index.js
[Appium] AndroidUiautomator2Driver has been successfully loaded in 1.334s
[Appium] Appium REST http interface listener started on http://127.0.0.1:4723/wd/hub
[Appium] Available drivers:
[Appium] - uiautomator2@3.7.1 (automationName ‘UiAutomator2’)
[Appium] Available plugins:
[Appium] - execute-driver@3.0.31
[Appium] - images@3.0.16
[Appium] - relaxed-caps@1.0.6
[Appium] No plugins activated. Use the --use-plugins flag with names of plugins to activate
Starting emulator using QEMU…
Waiting for emulator to start…
WARNING: Image format was not specified for ‘/root/android/system-images/x86_64/system.img’ and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the ‘raw’ format explicitly to remove the restrictions.
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Waiting for emulator to boot…
Emulator did not boot in expected time. Exiting…
qemu-system-x86_64: terminating on signal 1
Any suggestions are helpful !!