diff --git a/lib/sdk-installer.js b/lib/sdk-installer.js index 21d5c3a00..b9d80e2ad 100644 --- a/lib/sdk-installer.js +++ b/lib/sdk-installer.js @@ -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.'); @@ -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'); -} diff --git a/src/sdk-installer.ts b/src/sdk-installer.ts index b6f8111ad..f7e25fcf0 100644 --- a/src/sdk-installer.ts +++ b/src/sdk-installer.ts @@ -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.'); @@ -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'); -}