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

Fix SDK path issues with ubuntu-24.04 #409

Merged
merged 12 commits into from
Oct 11, 2024
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`);
}
Comment on lines -22 to -26
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally we needed to change the owner to accept preview SDK license: 49a3d04#diff-b14a072bf3d3c4d7027a549c57f0c1880f60206c24fc202ce4471ab9c0a5881cR23-R28

But this seems no longer required.


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