Visitar URL original
Fix #537: stop installing the deprecated `tools` package · android-actions/setup-android@7731365 · GitHub
Skip to content

Commit 7731365

Browse files
vbuberenclaude
authored andcommitted
Fix #537: stop installing the deprecated tools package
Google no longer serves the `tools` package: it is gone from repository2-3.xml, so `sdkmanager tools` fails with "Failed to find package 'tools'" and takes the whole action down with it. - Drop `tools` from the default value of the `packages` input, leaving `platform-tools`. The command line tools that replaced it are already installed by this action, and there is no bare `cmdline-tools` package path to install instead (only versioned ones, e.g. `cmdline-tools;20.0`). - Skip `tools` with a warning when it is requested explicitly, so the many workflows that pass `packages: 'tools platform-tools'` keep working instead of failing. - Update the README accordingly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 4d90f94 commit 7731365

4 files changed

Lines changed: 50 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
This action sets up the Android SDK tools by:
66
- Downloading the SDK commandline tools, if the current version (16.0) is not found in either `$ANDROID_SDK_ROOT` or `$HOME/.android/sdk`.
77
- Accepting the SDK licenses.
8-
- Installing `tools` and `platform-tools`.
8+
- Installing `platform-tools`.
99
- Adding `platform-tools` (contains adb) and `cmdline-tools/16.0/bin` (contains sdkmanager) to `$PATH`.
1010
- Setting up problem [matchers](/matchers.json).
1111

@@ -41,7 +41,7 @@ steps:
4141
## Additional packages
4242
Input parameter `packages` controls which packages this action will install from Android SDK.
4343

44-
Default value is `tools platform-tools`, supply an empty string to skip installing additional packages.
44+
Default value is `platform-tools`, supply an empty string to skip installing additional packages.
4545

4646
Additional packages can be installed at a later time by calling sdkmanager manually.
4747

@@ -53,9 +53,33 @@ Additional packages can be installed at a later time by calling sdkmanager manua
5353
5454
# ...
5555
56-
- run: sdkmanager tools platform-tools
56+
- run: sdkmanager platform-tools
5757
```
5858

59+
## The deprecated `tools` package
60+
61+
Google no longer serves the `tools` package, see [tools#tools-sdk](https://developer.android.com/tools#tools-sdk).
62+
Asking for it fails with `Failed to find package 'tools'`, so it is no longer part of the default value of `packages`.
63+
If it is requested explicitly, this action skips it with a warning rather than failing the build.
64+
65+
Most of what `tools` provided now lives in the command line tools, which this action installs and adds to `$PATH`
66+
regardless of the `packages` input, so these need no install step at all:
67+
68+
`apkanalyzer` `avdmanager` `lint` `screenshot2` `sdkmanager` `retrace` `resourceshrinker` `profgen` `d8` `r8`
69+
70+
The emulator was split out of `tools` into its own package, request it explicitly if you need it:
71+
72+
```yaml
73+
- name: Setup Android SDK
74+
uses: android-actions/setup-android@v4
75+
with:
76+
packages: 'platform-tools emulator'
77+
```
78+
79+
The remaining `tools` contents have no replacement in the current SDK: `android` was superseded by `sdkmanager` and
80+
`avdmanager`, ProGuard by [R8](https://developer.android.com/build/shrink-code), and `monitor`, `ddms`, `monkeyrunner`
81+
and `uiautomatorviewer` were dropped without one.
82+
5983
## SDK Version selection
6084

6185
Command line tools are versioned using two variables - short and long.

‎action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ inputs:
2121
packages:
2222
description: 'Additional packages to install'
2323
required: false
24-
default: 'tools platform-tools'
24+
default: 'platform-tools'
2525

2626
runs:
2727
using: node24

‎dist/index.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22422,6 +22422,9 @@ function debug(message) {
2242222422
function error(message, properties = {}) {
2242322423
issueCommand("error", toCommandProperties(properties), message instanceof Error ? message.toString() : message);
2242422424
}
22425+
function warning(message, properties = {}) {
22426+
issueCommand("warning", toCommandProperties(properties), message instanceof Error ? message.toString() : message);
22427+
}
2242522428
function info(message) {
2242622429
process.stdout.write(message + os5.EOL);
2242722430
}
@@ -22814,6 +22817,12 @@ async function run() {
2281422817
return str.trim();
2281522818
}).filter(function(element, index, array) {
2281622819
return element;
22820+
}).filter(function(pkg) {
22821+
if (pkg === "tools") {
22822+
warning("Skipping deprecated package 'tools', it is no longer available in the Android SDK repository. The command line tools installed by this action replace it, see https://developer.android.com/tools#tools-sdk");
22823+
return false;
22824+
}
22825+
return true;
2281722826
});
2281822827
for (const pkg of packages) {
2281922828
await callSdkManager(sdkManagerExe, pkg);

‎src/main.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ async function run(): Promise<void> {
175175
.filter(function (element, index, array) {
176176
return element
177177
})
178+
.filter(function (pkg) {
179+
// The 'tools' package is deprecated and no longer served by Google,
180+
// asking sdkmanager for it fails the whole action.
181+
// Its replacement, cmdline-tools, is already installed by this action.
182+
if (pkg === 'tools') {
183+
core.warning(
184+
"Skipping deprecated package 'tools', it is no longer available in the Android SDK repository. " +
185+
'The command line tools installed by this action replace it, see https://developer.android.com/tools#tools-sdk'
186+
)
187+
return false
188+
}
189+
return true
190+
})
178191
for (const pkg of packages) {
179192
await callSdkManager(sdkManagerExe, pkg)
180193
}

0 commit comments

Comments
 (0)