Skip to content

Commit 49a3d04

Browse files
committed
Fix sdk license issue with API 28+ system images on Linux.
1 parent 0d96655 commit 49a3d04

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

.github/workflows/workflow.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [macos-latest, ubuntu-latest]
17-
api-level: [16, 23, 29]
17+
api-level: [16, 23, 28, 29]
1818
exclude:
1919
- os: ubuntu-latest
2020
api-level: 23
2121
- os: ubuntu-latest
2222
api-level: 29
23+
- os: macos-latest
24+
api-level: 28
2325
steps:
2426
- name: checkout
2527
uses: actions/checkout@v2

lib/emulator-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
1616
};
1717
Object.defineProperty(exports, "__esModule", { value: true });
1818
const exec = __importStar(require("@actions/exec"));
19-
const EMULATOR_BOOT_TIMEOUT_SECONDS = 300;
19+
const EMULATOR_BOOT_TIMEOUT_SECONDS = 600;
2020
/**
2121
* Creates and launches a new AVD instance with the specified configurations.
2222
*/
@@ -99,7 +99,7 @@ function waitForDevice() {
9999
}
100100
}
101101
catch (error) {
102-
console.log(error.message);
102+
console.warn(error.message);
103103
}
104104
if (attempts < maxAttemps) {
105105
yield delay(retryInterval * 1000);

lib/sdk-installer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild) {
3535
yield exec.exec(`sudo rm -f commandlinetools.zip`);
3636
// add paths for commandline-tools and platform-tools
3737
core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
38-
yield exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`);
38+
// additional permission and license requirements for Linux
39+
if (!isOnMac) {
40+
yield exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`);
41+
yield exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`);
42+
}
3943
console.log('Installing latest build tools, platform tools, and platform.');
4044
yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
4145
if (emulatorBuild) {

src/emulator-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as exec from '@actions/exec';
22

3-
const EMULATOR_BOOT_TIMEOUT_SECONDS = 300;
3+
const EMULATOR_BOOT_TIMEOUT_SECONDS = 600;
44

55
/**
66
* Creates and launches a new AVD instance with the specified configurations.
@@ -81,7 +81,7 @@ async function waitForDevice(): Promise<void> {
8181
break;
8282
}
8383
} catch (error) {
84-
console.log(error.message);
84+
console.warn(error.message);
8585
}
8686

8787
if (attempts < maxAttemps) {

src/sdk-installer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
2020

2121
// add paths for commandline-tools and platform-tools
2222
core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
23-
await exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`);
23+
24+
// additional permission and license requirements for Linux
25+
if (!isOnMac) {
26+
await exec.exec(`sh -c \\"sudo chmod -R 777 ${process.env.ANDROID_HOME}"`);
27+
await exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`);
28+
}
2429

2530
console.log('Installing latest build tools, platform tools, and platform.');
2631

0 commit comments

Comments
 (0)