Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing some mistakes in sdk installation flow #327

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/sdk-installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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"`);
Expand Down
5 changes: 4 additions & 1 deletion src/sdk-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down Expand Up @@ -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"`);
Expand Down