From 21796bfa6d7ee67a69dfcc9da034ffad1b800119 Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Mon, 13 May 2024 17:01:04 +0200 Subject: [PATCH] Fixed emulator setup --- .github/actions/setup-host/action.yml | 21 ++++++++++++++++----- demo-project/ui-tests/build.gradle.kts | 10 +++++----- gradle/libs.versions.toml | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup-host/action.yml b/.github/actions/setup-host/action.yml index 7959750..4f04897 100644 --- a/.github/actions/setup-host/action.yml +++ b/.github/actions/setup-host/action.yml @@ -18,10 +18,21 @@ runs: uses: gradle/actions/setup-gradle@v3 with: cache-encryption-key: ${{ inputs.gradle-encryption-key }} - - name: Accept Android licences + cache-read-only: false + - name: Add Android SDK to PATH shell: bash - run: (yes || true) | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses - - # https://developer.android.com/studio/test/gradle-managed-devices#create_a_gradle_managed_device - name: Set `swiftshader_indirect` on Android Emulators (required by GHA) + run: | + echo "ANDROID_HOME=$ANDROID_HOME" >> "$GITHUB_ENV" + echo "$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools" >> "$GITHUB_PATH" + - name: Accept Android licences shell: bash - run: echo "android.testoptions.manageddevices.emulator.gpu=swiftshader_indirect" >> ~/.gradle/gradle.properties + run: yes | sdkmanager --licenses || true + - shell: bash + run: sdkmanager "system-images;android-34;aosp_atd;x86_64" + - shell: bash + run: avdmanager --verbose create avd --force --name "pixel_6_api30_aosp_atd_emulator" --package "system-images;android-34;aosp_atd;x86_64" --tag "aosp_atd" --abi "x86_64" --device "pixel_6" + - shell: bash + working-directory: ${{ env.ANDROID_HOME }}/tools + run: | + ls -l ../emulator/qemu/ + emulator -avd "pixel_6_api30_aosp_atd_emulator" -no-audio -no-window -gpu swiftshader_indirect -no-snapshot -camera-back none -camera-front none -selinux permissive -qemu -m 2048 diff --git a/demo-project/ui-tests/build.gradle.kts b/demo-project/ui-tests/build.gradle.kts index 678d178..a85fb84 100644 --- a/demo-project/ui-tests/build.gradle.kts +++ b/demo-project/ui-tests/build.gradle.kts @@ -25,15 +25,15 @@ android { } } -val pixel2 by android.testOptions.managedDevices.devices.creating(ManagedVirtualDevice::class) { - device = "Pixel 6" - apiLevel = 30 - systemImageSource = "aosp-atd" +val emulator by android.testOptions.managedDevices.devices.creating(ManagedVirtualDevice::class) { + device = "Pixel 2" + apiLevel = libs.versions.android.compileSDK.get().toInt() + systemImageSource = "aosp_atd" } baselineProfile { useConnectedDevices = false - managedDevices += pixel2.name + managedDevices += emulator.name } dependencies { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c793b62..6131b4c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] kotlin = "1.9.23" -agp = "8.4.0" +agp = "8.3.2" android-minSDK = "21" android-compileSDK = "34" androidx-lifecycle = "2.7.0"