Skip to content

Commit

Permalink
Accept all Android SDK Licenses
Browse files Browse the repository at this point in the history
Fixes #168
  • Loading branch information
marcuspridham authored and ychescale9 committed Jul 20, 2021
1 parent 25bcfba commit 08852ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
15 changes: 2 additions & 13 deletions lib/sdk-installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,8 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cm
core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_SDK_ROOT}/platform-tools`);
// set standard AVD path
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
// additional permission and license requirements for Linux
const sdkPreviewLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-preview-license`;
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
fs.writeFileSync(sdkPreviewLicensePath, '\n84831b9409646a918e30573bab4c9c91346d8abd');
}
// license required for API 30 and non-default API 28 system images
const sdkArmDbtLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-arm-dbt-license`;
if (requiresArmDbtLicense(apiLevel, target) && !fs.existsSync(sdkArmDbtLicensePath)) {
fs.writeFileSync(sdkArmDbtLicensePath, '\n859f317696f67ef3d7f30a50a5560e7834b43903');
}
// accept all Android SDK licenses
yield exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`);
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"`);
console.log('Installing latest emulator.');
Expand All @@ -94,6 +86,3 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cm
});
}
exports.installAndroidSdk = installAndroidSdk;
function requiresArmDbtLicense(apiLevel, target) {
return apiLevel === 30 || (apiLevel === 28 && target !== 'default');
}
17 changes: 2 additions & 15 deletions src/sdk-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,8 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
// set standard AVD path
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);

// additional permission and license requirements for Linux
const sdkPreviewLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-preview-license`;
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
fs.writeFileSync(sdkPreviewLicensePath, '\n84831b9409646a918e30573bab4c9c91346d8abd');
}

// license required for API 30 and non-default API 28 system images
const sdkArmDbtLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-arm-dbt-license`;
if (requiresArmDbtLicense(apiLevel, target) && !fs.existsSync(sdkArmDbtLicensePath)) {
fs.writeFileSync(sdkArmDbtLicensePath, '\n859f317696f67ef3d7f30a50a5560e7834b43903');
}
// accept all Android SDK licenses
await exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`);

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

Expand Down Expand Up @@ -73,7 +64,3 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
await exec.exec(`sh -c \\"sdkmanager --install 'cmake;${cmakeVersion}' > /dev/null"`);
}
}

function requiresArmDbtLicense(apiLevel: number, target: string): boolean {
return apiLevel === 30 || (apiLevel === 28 && target !== 'default');
}

0 comments on commit 08852ad

Please sign in to comment.