Skip to content

Commit

Permalink
Added Android SDK setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Oct 21, 2023
1 parent 394bf36 commit fe11ce9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/setup-host/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,21 @@ runs:
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup `ANDROID_HOME` environment variable
shell: bash
run: echo ANDROID_HOME=~/android/sdk >> $GITHUB_ENV
- name: Cache Android SDK
uses: actions/cache@v3
with:
key: ${{ runner.os }}/${{ runner.arch }}-android-sdk
path: ${{ env.ANDROID_HOME }}
- name: Setup host for Android Emulator
shell: bash
run: |
# https://developer.android.com/studio/test/gradle-m./granaged-devices#create_a_gradle_managed_device
echo "android.testoptions.manageddevices.emulator.gpu=swiftshader_indirect" >> ~/.gradle/gradle.properties
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
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
12 changes: 12 additions & 0 deletions demo-project/ui-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@ dependencies {
implementation(libs.androidx.test.junit)
implementation(libs.androidx.test.espresso)
}

val acceptAndroidLicences by tasks.registering(Exec::class) {
val androidHome = androidComponents.sdkComponents.sdkDirectory.get().asFile.absolutePath

commandLine("bash", "-c", "yes | $androidHome/cmdline-tools/latest/bin/sdkmanager --licenses")
}

afterEvaluate {
tasks.named("${pixel2.name}Setup") {
dependsOn(acceptAndroidLicences)
}
}

0 comments on commit fe11ce9

Please sign in to comment.