From 49a3d042e9cc6a9f969d767b7e63b59d85a5cb83 Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Wed, 1 Apr 2020 00:23:10 +1100 Subject: [PATCH 1/2] Fix sdk license issue with API 28+ system images on Linux. --- .github/workflows/workflow.yml | 4 +++- lib/emulator-manager.js | 4 ++-- lib/sdk-installer.js | 6 +++++- src/emulator-manager.ts | 4 ++-- src/sdk-installer.ts | 7 ++++++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 2a92fc8d8..029f8092d 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -14,12 +14,14 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest] - api-level: [16, 23, 29] + api-level: [16, 23, 28, 29] exclude: - os: ubuntu-latest api-level: 23 - os: ubuntu-latest api-level: 29 + - os: macos-latest + api-level: 28 steps: - name: checkout uses: actions/checkout@v2 diff --git a/lib/emulator-manager.js b/lib/emulator-manager.js index 160bd2768..c8c788d11 100644 --- a/lib/emulator-manager.js +++ b/lib/emulator-manager.js @@ -16,7 +16,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const exec = __importStar(require("@actions/exec")); -const EMULATOR_BOOT_TIMEOUT_SECONDS = 300; +const EMULATOR_BOOT_TIMEOUT_SECONDS = 600; /** * Creates and launches a new AVD instance with the specified configurations. */ @@ -99,7 +99,7 @@ function waitForDevice() { } } catch (error) { - console.log(error.message); + console.warn(error.message); } if (attempts < maxAttemps) { yield delay(retryInterval * 1000); diff --git a/lib/sdk-installer.js b/lib/sdk-installer.js index 1d7b00e1b..e8fb3ab4a 100644 --- a/lib/sdk-installer.js +++ b/lib/sdk-installer.js @@ -35,7 +35,11 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild) { yield exec.exec(`sudo rm -f commandlinetools.zip`); // add paths for commandline-tools and platform-tools core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`); - yield exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`); + // additional permission and license requirements for Linux + if (!isOnMac) { + yield exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`); + yield exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`); + } console.log('Installing latest build tools, platform tools, and platform.'); yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`); if (emulatorBuild) { diff --git a/src/emulator-manager.ts b/src/emulator-manager.ts index 83f2c40fc..03ebe5027 100644 --- a/src/emulator-manager.ts +++ b/src/emulator-manager.ts @@ -1,6 +1,6 @@ import * as exec from '@actions/exec'; -const EMULATOR_BOOT_TIMEOUT_SECONDS = 300; +const EMULATOR_BOOT_TIMEOUT_SECONDS = 600; /** * Creates and launches a new AVD instance with the specified configurations. @@ -81,7 +81,7 @@ async function waitForDevice(): Promise { break; } } catch (error) { - console.log(error.message); + console.warn(error.message); } if (attempts < maxAttemps) { diff --git a/src/sdk-installer.ts b/src/sdk-installer.ts index 8d2f4bcbb..fa7c69a58 100644 --- a/src/sdk-installer.ts +++ b/src/sdk-installer.ts @@ -20,7 +20,12 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch: // add paths for commandline-tools and platform-tools core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`); - await exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`); + + // additional permission and license requirements for Linux + if (!isOnMac) { + await exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`); + await exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`); + } console.log('Installing latest build tools, platform tools, and platform.'); From 22965df7229f0909b6852bd7ba8e3237a399a957 Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Wed, 1 Apr 2020 00:51:14 +1100 Subject: [PATCH 2/2] Prepare for release 2.6.1. --- CHANGELOG.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24e5a01f7..35193d9e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,25 @@ # Change Log +## v2.6.1 + +* Fixed SDK license issue on Linux when downloading API 28+ system images - [#42](https://github.com/ReactiveCircus/android-emulator-runner/issues/42). + ## v2.6.0 -* Added support for Linux VMs (no hardware acceleration). +* Added support for Linux VMs (no hardware acceleration) - [#15](https://github.com/ReactiveCircus/android-emulator-runner/issues/15). ## v2.5.0 -* Added support for API 15-19 system images. -* Switched to the new SDK command-line tools which supports running `sdkmanager` and `avdmanager` with Java 9+. +* Added support for API 15-19 system images - [#26](https://github.com/ReactiveCircus/android-emulator-runner/issues/26). +* Switched to the new SDK command-line tools which supports running `sdkmanager` and `avdmanager` with Java 9+ - [#25](https://github.com/ReactiveCircus/android-emulator-runner/issues/25). ## v2.4.0 -* Added support for setting custom `working-directory` - e.g. `./android` if your root Gradle project is under the `./android` sub-directory within your repository. +* Added support for setting custom `working-directory` - e.g. `./android` if your root Gradle project is under the `./android` sub-directory within your repository - [#22](https://github.com/ReactiveCircus/android-emulator-runner/issues/22). ## v2.3.2 -* Fixed an issue where environment variables are escaped in script. +* Fixed an issue where environment variables are escaped in script - [#19](https://github.com/ReactiveCircus/android-emulator-runner/issues/19). ## v2.3.1