Skip to content

Commit 4ec7574

Browse files
committed
test(android, ci): use headless emulator binary in E2E workflow
Swap to emulator-headless before launch so CI avoids host libX11-xcb dependency on newer emulator builds. Install pulseaudio and libxkbfile1 for libpulse.so.0 and libxkbfile.so.1 on Ubuntu 24.04. Log unresolved emulator shared-library deps via ldd before launch (temporary). Keeps the existing emulator pin for now.
1 parent 4745955 commit 4ec7574

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/tests_e2e_android.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ jobs:
122122
sudo udevadm control --reload-rules
123123
sudo udevadm trigger --name-match=kvm
124124
125+
- name: Install emulator host dependencies
126+
# Headless emulator still dlopens host libs not bundled since emulator 36.3+.
127+
# pulseaudio -> libpulse.so.0; libxkbfile1 -> libxkbfile.so.1 (Ubuntu 24.04 noble on ubuntu-latest).
128+
run: |
129+
sudo apt-get update
130+
sudo apt-get install -y --no-install-recommends pulseaudio libxkbfile1
131+
125132
# https://github.com/actions/checkout/releases
126133
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
127134
with:
@@ -241,11 +248,44 @@ jobs:
241248
disable-spellchecker: true
242249
arch: ${{ matrix.arch }}
243250
emulator-build: 14214601 # needed as of 20251205 when emulator 36.3.10.0 (build_id 14472402) released
251+
# Headless binary replaces -no-window; see pre-emulator-launch-script.
252+
emulator-options: -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
244253
pre-emulator-launch-script: |
245254
sudo mkdir /mnt/avd
246255
sudo chown $USER:$USER /mnt/avd
247256
mkdir -p $HOME/.android
248257
ln -s /mnt/avd $HOME/.android/avd
258+
259+
EMULATOR_DIR="$ANDROID_HOME/emulator"
260+
261+
# Temporary: surface any unresolved emulator shared-library deps in CI logs.
262+
report_missing_libs() {
263+
local binary="$1"
264+
if [ ! -f "$binary" ]; then
265+
echo "ldd skip (missing): $binary"
266+
return
267+
fi
268+
if ! file "$binary" | grep -q ELF; then
269+
echo "ldd skip (not ELF): $binary"
270+
return
271+
fi
272+
echo "==> ldd missing libs for $binary"
273+
ldd "$binary" | grep 'not found' || echo " (none)"
274+
}
275+
report_missing_libs "$EMULATOR_DIR/emulator"
276+
report_missing_libs "$EMULATOR_DIR/emulator-headless"
277+
report_missing_libs "$EMULATOR_DIR/qemu/linux-x86_64/qemu-system-x86_64-headless"
278+
report_missing_libs "$EMULATOR_DIR/qemu/linux-x86_64/qemu-system-x86_64"
279+
280+
# android-emulator-runner always invokes $ANDROID_HOME/emulator/emulator.
281+
# Swap to emulator-headless so newer builds avoid host libX11-xcb dependency.
282+
if [ -x "$EMULATOR_DIR/emulator-headless" ]; then
283+
mv "$EMULATOR_DIR/emulator" "$EMULATOR_DIR/emulator-gui"
284+
ln -sf emulator-headless "$EMULATOR_DIR/emulator"
285+
else
286+
echo "emulator-headless not found in $EMULATOR_DIR" >&2
287+
exit 1
288+
fi
249289
script: |
250290
$ANDROID_HOME/platform-tools/adb devices
251291
nohup sh -c "$ANDROID_HOME/platform-tools/adb logcat '*:D' > adb-log.txt" &

0 commit comments

Comments
 (0)