From def029a44c3312fc6e0d059c8b951c0b8246d0eb Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 27 Aug 2025 17:13:42 +0200 Subject: [PATCH 1/7] build: improve AVD startup time --- .github/workflows/android.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 22dd6f85..4d94a646 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -41,7 +41,17 @@ jobs: run: bun run build:android working-directory: example + - name: AVD cache + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-30-x86 + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 with: # Use the slimmer aosp_atd images for working @@ -62,5 +72,27 @@ jobs: emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none emulator-boot-timeout: 12000 disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: Run build + uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 + with: + # Use the slimmer aosp_atd images for working + # around "System UI isn't responding" ANR + # (Application Not Responding) error + # + # https://android-developers.googleblog.com/2021/10/whats-new-in-scalable-automated-testing.html#:~:text=Slimmer%20Emulator%20System%20Images + # https://github.com/ReactiveCircus/android-emulator-runner/issues/129 + # https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722 + target: aosp_atd + api-level: 30 + arch: x86 + channel: canary + profile: pixel + avd-name: Pixel_3a_API_30_AOSP + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + emulator-boot-timeout: 12000 + disable-animations: false script: | bun example:android:release From 0a5748bc93c226f172e5de393bb999e0907899c9 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 27 Aug 2025 17:43:39 +0200 Subject: [PATCH 2/7] build: bump versions --- .github/workflows/android.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 4d94a646..dead0f1b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,7 +14,7 @@ on: jobs: android-build: - runs-on: macos-13 # emulator never starts on macOS 14 https://github.com/ReactiveCircus/android-emulator-runner/issues/392#issuecomment-2106167725 + runs-on: macos-15 concurrency: group: ${{ github.ref }}-android cancel-in-progress: true @@ -48,7 +48,7 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-30-x86 + key: avd-35-arm64-v8a - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' @@ -62,8 +62,8 @@ jobs: # https://github.com/ReactiveCircus/android-emulator-runner/issues/129 # https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722 target: aosp_atd - api-level: 30 - arch: x86 + api-level: 35 + arch: arm64-v8a ram-size: 4096M channel: canary profile: pixel @@ -85,8 +85,8 @@ jobs: # https://github.com/ReactiveCircus/android-emulator-runner/issues/129 # https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722 target: aosp_atd - api-level: 30 - arch: x86 + api-level: 35 + arch: arm64-v8a channel: canary profile: pixel avd-name: Pixel_3a_API_30_AOSP From 9033e1badf1652667f1932017af8db90a49ebdeb Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 27 Aug 2025 17:47:41 +0200 Subject: [PATCH 3/7] build: use built-in system image --- .github/workflows/android.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index dead0f1b..7d5257e3 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -54,18 +54,9 @@ jobs: if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 with: - # Use the slimmer aosp_atd images for working - # around "System UI isn't responding" ANR - # (Application Not Responding) error - # - # https://android-developers.googleblog.com/2021/10/whats-new-in-scalable-automated-testing.html#:~:text=Slimmer%20Emulator%20System%20Images - # https://github.com/ReactiveCircus/android-emulator-runner/issues/129 - # https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722 - target: aosp_atd api-level: 35 arch: arm64-v8a ram-size: 4096M - channel: canary profile: pixel avd-name: Pixel_3a_API_30_AOSP force-avd-creation: false @@ -77,17 +68,8 @@ jobs: - name: Run build uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 with: - # Use the slimmer aosp_atd images for working - # around "System UI isn't responding" ANR - # (Application Not Responding) error - # - # https://android-developers.googleblog.com/2021/10/whats-new-in-scalable-automated-testing.html#:~:text=Slimmer%20Emulator%20System%20Images - # https://github.com/ReactiveCircus/android-emulator-runner/issues/129 - # https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722 - target: aosp_atd api-level: 35 arch: arm64-v8a - channel: canary profile: pixel avd-name: Pixel_3a_API_30_AOSP force-avd-creation: false From b7c972bcee431bfcf7dbfd1b2cb8a5aecb505d20 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 27 Aug 2025 17:53:09 +0200 Subject: [PATCH 4/7] build: use linux runner --- .github/workflows/android.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 7d5257e3..aae1e88b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,7 +14,7 @@ on: jobs: android-build: - runs-on: macos-15 + runs-on: ubuntu-latest concurrency: group: ${{ github.ref }}-android cancel-in-progress: true @@ -48,14 +48,14 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-35-arm64-v8a + key: avd-35-arm64-x86_64 - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 with: api-level: 35 - arch: arm64-v8a + arch: x86_64 ram-size: 4096M profile: pixel avd-name: Pixel_3a_API_30_AOSP @@ -69,7 +69,7 @@ jobs: uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 with: api-level: 35 - arch: arm64-v8a + arch: x86_64 profile: pixel avd-name: Pixel_3a_API_30_AOSP force-avd-creation: false From ef3260d489bf0a6385fd8abf63773cd2d5b04d81 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 27 Aug 2025 18:02:02 +0200 Subject: [PATCH 5/7] build: enable KVM --- .github/workflows/android.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index aae1e88b..7f53d801 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -50,6 +50,13 @@ jobs: ~/.android/adb* key: avd-35-arm64-x86_64 + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + ls /dev/kvm + - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 From 7c95000a9634e3c7de2c394b7ae973ac14150da7 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 27 Aug 2025 18:18:03 +0200 Subject: [PATCH 6/7] build: use active-arch-only --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f825d46..812f077f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "example:start": "cd example; bun start", "example:android": "cd example; bun android", "example:ios": "cd example; bun ios", - "example:android:release": "cd example;react-native run-android --mode \"Release\" --appId com.pagerviewexample", + "example:android:release": "cd example;react-native run-android --mode \"Release\" --appId com.pagerviewexample --active-arch-only", "example:ios:release": "cd example;react-native run-ios --mode \"Release\"" }, "keywords": [ From 002f3129b1ed3ed743292555b9a26794e94414e8 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 27 Aug 2025 18:29:17 +0200 Subject: [PATCH 7/7] build: use google repository by default --- example/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/android/build.gradle b/example/android/build.gradle index d8bcc3ae..7fae3a55 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -11,8 +11,8 @@ buildscript { }()) repositories { - mavenCentral() google() + mavenCentral() } dependencies {