mirror of
https://github.com/android-actions/setup-android.git
synced 2026-09-23 13:18:36 +00:00
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>
This commit is contained in:
committed by
Vilius Sutkus '89
co-authored by
Claude Opus 5
parent
4d90f94363
commit
7731365548
@@ -5,7 +5,7 @@
|
|||||||
This action sets up the Android SDK tools by:
|
This action sets up the Android SDK tools by:
|
||||||
- Downloading the SDK commandline tools, if the current version (16.0) is not found in either `$ANDROID_SDK_ROOT` or `$HOME/.android/sdk`.
|
- Downloading the SDK commandline tools, if the current version (16.0) is not found in either `$ANDROID_SDK_ROOT` or `$HOME/.android/sdk`.
|
||||||
- Accepting the SDK licenses.
|
- Accepting the SDK licenses.
|
||||||
- Installing `tools` and `platform-tools`.
|
- Installing `platform-tools`.
|
||||||
- Adding `platform-tools` (contains adb) and `cmdline-tools/16.0/bin` (contains sdkmanager) to `$PATH`.
|
- Adding `platform-tools` (contains adb) and `cmdline-tools/16.0/bin` (contains sdkmanager) to `$PATH`.
|
||||||
- Setting up problem [matchers](/matchers.json).
|
- Setting up problem [matchers](/matchers.json).
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ steps:
|
|||||||
## Additional packages
|
## Additional packages
|
||||||
Input parameter `packages` controls which packages this action will install from Android SDK.
|
Input parameter `packages` controls which packages this action will install from Android SDK.
|
||||||
|
|
||||||
Default value is `tools platform-tools`, supply an empty string to skip installing additional packages.
|
Default value is `platform-tools`, supply an empty string to skip installing additional packages.
|
||||||
|
|
||||||
Additional packages can be installed at a later time by calling sdkmanager manually.
|
Additional packages can be installed at a later time by calling sdkmanager manually.
|
||||||
|
|
||||||
@@ -53,9 +53,33 @@ Additional packages can be installed at a later time by calling sdkmanager manua
|
|||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
- run: sdkmanager tools platform-tools
|
- run: sdkmanager platform-tools
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## The deprecated `tools` package
|
||||||
|
|
||||||
|
Google no longer serves the `tools` package, see [tools#tools-sdk](https://developer.android.com/tools#tools-sdk).
|
||||||
|
Asking for it fails with `Failed to find package 'tools'`, so it is no longer part of the default value of `packages`.
|
||||||
|
If it is requested explicitly, this action skips it with a warning rather than failing the build.
|
||||||
|
|
||||||
|
Most of what `tools` provided now lives in the command line tools, which this action installs and adds to `$PATH`
|
||||||
|
regardless of the `packages` input, so these need no install step at all:
|
||||||
|
|
||||||
|
`apkanalyzer` `avdmanager` `lint` `screenshot2` `sdkmanager` `retrace` `resourceshrinker` `profgen` `d8` `r8`
|
||||||
|
|
||||||
|
The emulator was split out of `tools` into its own package, request it explicitly if you need it:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup Android SDK
|
||||||
|
uses: android-actions/setup-android@v4
|
||||||
|
with:
|
||||||
|
packages: 'platform-tools emulator'
|
||||||
|
```
|
||||||
|
|
||||||
|
The remaining `tools` contents have no replacement in the current SDK: `android` was superseded by `sdkmanager` and
|
||||||
|
`avdmanager`, ProGuard by [R8](https://developer.android.com/build/shrink-code), and `monitor`, `ddms`, `monkeyrunner`
|
||||||
|
and `uiautomatorviewer` were dropped without one.
|
||||||
|
|
||||||
## SDK Version selection
|
## SDK Version selection
|
||||||
|
|
||||||
Command line tools are versioned using two variables - short and long.
|
Command line tools are versioned using two variables - short and long.
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ inputs:
|
|||||||
packages:
|
packages:
|
||||||
description: 'Additional packages to install'
|
description: 'Additional packages to install'
|
||||||
required: false
|
required: false
|
||||||
default: 'tools platform-tools'
|
default: 'platform-tools'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node24
|
using: node24
|
||||||
|
|||||||
Vendored
+9
@@ -22422,6 +22422,9 @@ function debug(message) {
|
|||||||
function error(message, properties = {}) {
|
function error(message, properties = {}) {
|
||||||
issueCommand("error", toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
issueCommand("error", toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||||
}
|
}
|
||||||
|
function warning(message, properties = {}) {
|
||||||
|
issueCommand("warning", toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||||
|
}
|
||||||
function info(message) {
|
function info(message) {
|
||||||
process.stdout.write(message + os5.EOL);
|
process.stdout.write(message + os5.EOL);
|
||||||
}
|
}
|
||||||
@@ -22814,6 +22817,12 @@ async function run() {
|
|||||||
return str.trim();
|
return str.trim();
|
||||||
}).filter(function(element, index, array) {
|
}).filter(function(element, index, array) {
|
||||||
return element;
|
return element;
|
||||||
|
}).filter(function(pkg) {
|
||||||
|
if (pkg === "tools") {
|
||||||
|
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");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
for (const pkg of packages) {
|
for (const pkg of packages) {
|
||||||
await callSdkManager(sdkManagerExe, pkg);
|
await callSdkManager(sdkManagerExe, pkg);
|
||||||
|
|||||||
+13
@@ -175,6 +175,19 @@ async function run(): Promise<void> {
|
|||||||
.filter(function (element, index, array) {
|
.filter(function (element, index, array) {
|
||||||
return element
|
return element
|
||||||
})
|
})
|
||||||
|
.filter(function (pkg) {
|
||||||
|
// The 'tools' package is deprecated and no longer served by Google,
|
||||||
|
// asking sdkmanager for it fails the whole action.
|
||||||
|
// Its replacement, cmdline-tools, is already installed by this action.
|
||||||
|
if (pkg === 'tools') {
|
||||||
|
core.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'
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
for (const pkg of packages) {
|
for (const pkg of packages) {
|
||||||
await callSdkManager(sdkManagerExe, pkg)
|
await callSdkManager(sdkManagerExe, pkg)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user