From 4a130f092d0dcf322a1324df2a2214ece43d649e Mon Sep 17 00:00:00 2001 From: Ildar Valiullin Date: Thu, 2 Mar 2023 23:11:35 +0300 Subject: [PATCH] fixed some mistakes in sdk installation flow --- lib/sdk-installer.js | 4 +++- src/sdk-installer.ts | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/sdk-installer.js b/lib/sdk-installer.js index 781ec61a8..b6b680bbd 100644 --- a/lib/sdk-installer.js +++ b/lib/sdk-installer.js @@ -51,7 +51,7 @@ function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndk console.log(`::group::Install Android SDK`); const isOnMac = process.platform === 'darwin'; if (!isOnMac) { - yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`); + yield exec.exec(`sh -c \\"sudo chown $(id -u):$(id -g) ${process.env.ANDROID_HOME} -R`); } const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`; if (!fs.existsSync(cmdlineToolsPath)) { @@ -81,6 +81,8 @@ function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndk } console.log('Installing system images.'); yield exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' --channel=${channelId} > /dev/null"`); + console.log('Installing platforms.'); + yield exec.exec(`sh -c \\"sdkmanager --install 'platforms;android-${apiLevel}' --channel=${channelId} > /dev/null"`); if (ndkVersion) { console.log(`Installing NDK ${ndkVersion}.`); yield exec.exec(`sh -c \\"sdkmanager --install 'ndk;${ndkVersion}' --channel=${channelId} > /dev/null"`); diff --git a/src/sdk-installer.ts b/src/sdk-installer.ts index 4383c6bf5..0fd7d69e3 100644 --- a/src/sdk-installer.ts +++ b/src/sdk-installer.ts @@ -18,7 +18,7 @@ export async function installAndroidSdk(apiLevel: string, target: string, arch: const isOnMac = process.platform === 'darwin'; if (!isOnMac) { - await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`); + await exec.exec(`sh -c \\"sudo chown $(id -u):$(id -g) ${process.env.ANDROID_HOME} -R`); } const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`; @@ -57,6 +57,9 @@ export async function installAndroidSdk(apiLevel: string, target: string, arch: console.log('Installing system images.'); await exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' --channel=${channelId} > /dev/null"`); + console.log('Installing platforms.'); + await exec.exec(`sh -c \\"sdkmanager --install 'platforms;android-${apiLevel}' --channel=${channelId} > /dev/null"`); + if (ndkVersion) { console.log(`Installing NDK ${ndkVersion}.`); await exec.exec(`sh -c \\"sdkmanager --install 'ndk;${ndkVersion}' --channel=${channelId} > /dev/null"`);