Skip to content

Commit

Permalink
Fix SDK path issues with ubuntu-24.04 (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 authored Oct 11, 2024
1 parent 3a18f50 commit 8c07710
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-22.04
api-level: 23
target: default
arch: x86
- os: ubuntu-latest
- os: ubuntu-24.04
api-level: 24
target: playstore
arch: x86
- os: macos-13
api-level: 31
target: default
arch: x86_64
- os: ubuntu-latest
- os: ubuntu-24.04
api-level: 34
target: aosp_atd
arch: x86_64
- os: ubuntu-latest
- os: ubuntu-24.04
api-level: 35
target: google_apis
arch: x86_64
Expand Down
6 changes: 1 addition & 5 deletions lib/sdk-installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndk
console.log(`::group::Install Android SDK`);
const isOnMac = process.platform === 'darwin';
const isArm = process.arch === 'arm64';
if (!isOnMac) {
yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME}/platform-tools -R`);
yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME}/cmdline-tools/latest -R`);
yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME}/build-tools/${BUILD_TOOLS_VERSION} -R`);
}
const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`;
if (!fs.existsSync(cmdlineToolsPath)) {
console.log('Installing new cmdline-tools.');
Expand All @@ -68,6 +63,7 @@ function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndk
// add paths for commandline-tools and platform-tools
core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`);
// set standard AVD path
yield io.mkdirP(`${process.env.HOME}/.android/avd`);
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
// accept all Android SDK licenses
yield exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`);
Expand Down
7 changes: 1 addition & 6 deletions src/sdk-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ export async function installAndroidSdk(apiLevel: string, target: string, arch:
const isOnMac = process.platform === 'darwin';
const isArm = process.arch === 'arm64';

if (!isOnMac) {
await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME}/platform-tools -R`);
await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME}/cmdline-tools/latest -R`);
await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME}/build-tools/${BUILD_TOOLS_VERSION} -R`);
}

const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`;
if (!fs.existsSync(cmdlineToolsPath)) {
console.log('Installing new cmdline-tools.');
Expand All @@ -38,6 +32,7 @@ export async function installAndroidSdk(apiLevel: string, target: string, arch:
core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`);

// set standard AVD path
await io.mkdirP(`${process.env.HOME}/.android/avd`);
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);

// accept all Android SDK licenses
Expand Down

0 comments on commit 8c07710

Please sign in to comment.