Skip to content

Commit e9e3615

Browse files
fix(ci): upgrade android-actions/setup-android from v2 to v3 (#169)
* fix(ci): upgrade android-actions/setup-android from v2 to v3 v2 fails to accept new Android SDK license agreements (GoogleTV and XR emulator licenses) on Ubicloud runners that lack pre-accepted licenses. v3 handles license acceptance more robustly via piped input. Fixes the Build apk/aab job failure on master. * fix(ci): pin ANDROID_AVD_HOME for setup-android@v3 compatibility android-actions/setup-android@v3 no longer sets ANDROID_SDK_HOME (deprecated by Google), which caused avdmanager to write the AVD to a location the emulator binary couldn't find. Explicitly set ANDROID_AVD_HOME=$HOME/.android/avd before running avdmanager and persist it to GITHUB_ENV for the Start emulator step. Also adds ls verification so future failures show the AVD directory state.
1 parent edca195 commit e9e3615

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
# Android SDK & NDK
4343
- name: Set up Android SDK
4444
if: steps.cache-jniLibs.outputs.cache-hit != 'true'
45-
uses: android-actions/setup-android@v2
45+
uses: android-actions/setup-android@v3
4646
- name: Set up Android NDK
4747
if: steps.cache-jniLibs.outputs.cache-hit != 'true'
4848
run: |
@@ -196,7 +196,7 @@ jobs:
196196

197197
# Android SDK & NDK
198198
- name: Set up Android SDK
199-
uses: android-actions/setup-android@v2
199+
uses: android-actions/setup-android@v3
200200
- name: Set up Android NDK
201201
run: |
202202
sdkmanager "ndk;${{ env.NDK_VERSION }}"
@@ -281,7 +281,7 @@ jobs:
281281

282282
# Android SDK & NDK (NDK required at Gradle configuration time even for JVM unit tests)
283283
- name: Set up Android SDK
284-
uses: android-actions/setup-android@v2
284+
uses: android-actions/setup-android@v3
285285
- name: Set up Android NDK
286286
run: |
287287
sdkmanager "ndk;${{ env.NDK_VERSION }}"
@@ -344,17 +344,30 @@ jobs:
344344
run: brew install intel-haxm
345345

346346
- name: Set up Android SDK
347-
uses: android-actions/setup-android@v2
347+
uses: android-actions/setup-android@v3
348348

349349
# # # Below code is majorly from https://github.com/actions/runner-images/issues/6152#issuecomment-1243718140
350350
- name: Create Android emulator
351351
run: |
352+
# Pin AVD home so avdmanager and emulator agree on the location.
353+
# android-actions/setup-android@v3 no longer exports ANDROID_SDK_HOME
354+
# (it was deprecated by Google), so we set ANDROID_AVD_HOME explicitly
355+
# and persist it for subsequent steps via GITHUB_ENV.
356+
AVD_HOME="$HOME/.android/avd"
357+
mkdir -p "$AVD_HOME"
358+
echo "ANDROID_AVD_HOME=$AVD_HOME" >> "$GITHUB_ENV"
359+
export ANDROID_AVD_HOME="$AVD_HOME"
360+
352361
# Install AVD files
353362
echo "y" | sdkmanager --install 'system-images;android-'$MATRIX_E_SDK';default;x86_64'
354363
echo "y" | sdkmanager --licenses
355364
356365
# Create emulator
357366
avdmanager create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';default;x86_64'
367+
368+
# Verify AVD was created before proceeding
369+
echo "AVDs in $ANDROID_AVD_HOME:"
370+
ls -la "$ANDROID_AVD_HOME/" 2>/dev/null || echo "WARNING: AVD directory empty after creation!"
358371
$ANDROID_HOME/emulator/emulator -list-avds
359372
if false; then
360373
emulator_config=~/.android/avd/$MATRIX_AVD.avd/config.ini

0 commit comments

Comments
 (0)