Skip to content

Commit

Permalink
Fixed emulator setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed May 14, 2024
1 parent cef1b30 commit 5ed9b03
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
19 changes: 14 additions & 5 deletions .github/actions/setup-host/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ 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: 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
10 changes: 5 additions & 5 deletions demo-project/ui-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 5ed9b03

Please sign in to comment.