diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..36a554a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [1.0.2] - Unreleased + +- Also export `ANDROID_SDK_ROOT` for compatibility with newer Gradle plugins + that read it directly. diff --git a/README.md b/README.md index 47e5d80..c0a0a31 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ steps: | Input | Default | Description | |---|---|---| | `packages` | `''` | SDK packages to install, space- or newline-separated (slash syntax). Empty = CLI only. | -| `sdk-path` | platform default | Override SDK install location. Exported as `ANDROID_HOME`. | +| `sdk-path` | platform default | Override SDK install location. Exported as both `ANDROID_HOME` and `ANDROID_SDK_ROOT`. | | `cache` | `'true'` | Cache `~/.android/bin` and the SDK between runs. | | `cache-key` | `''` | Extra input appended to cache key (for busting). | | `no-metrics` | `'true'` | Pass `--no-metrics` to opt out of CLI telemetry. | @@ -87,11 +87,20 @@ steps: | `cli-version` | Version string from `android --version`. | | `cache-hit` | Whether the cache was restored (`true`/`false`, empty if caching disabled). | +## Environment + +The action exports the following environment variables for subsequent steps: + +| Variable | Description | +|---|---| +| `ANDROID_HOME` | Absolute path to the SDK. Set for back-compat with older tooling. | +| `ANDROID_SDK_ROOT` | Same value as `ANDROID_HOME`. Set because newer Android tooling (AGP 8.x, recent Gradle plugins, the cmdline-tools `sdkmanager`) reads this variable first and only falls back to `ANDROID_HOME` when it is unset. | + ## What it does 1. Downloads the `android` CLI launcher (~5 MB) into the runner's tool cache. 2. Unpacks embedded resources on first run into `~/.android/bin/` (~78 MB, cached). -3. Exports `ANDROID_HOME` and adds `platform-tools/`, `emulator/`, and `cmdline-tools/latest/bin/` to `PATH`. +3. Exports `ANDROID_HOME` and `ANDROID_SDK_ROOT`, and adds `platform-tools/`, `emulator/`, and `cmdline-tools/latest/bin/` to `PATH`. 4. Runs `android sdk install ` if packages are specified. 5. Registers Gradle, Kotlin, and Android Lint [problem matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) so build errors show inline in the GitHub UI. 6. Writes a job summary table with CLI version, SDK path, and cache status. diff --git a/action.yml b/action.yml index 7a169c0..5d08c71 100644 --- a/action.yml +++ b/action.yml @@ -19,7 +19,8 @@ inputs: description: >- Override where the Android SDK is installed. Defaults to `~/Library/Android/sdk` on macOS and `~/Android/Sdk` on Linux. The - chosen path is exported as `ANDROID_HOME` for subsequent steps. + chosen path is exported as `ANDROID_HOME` and `ANDROID_SDK_ROOT` for + subsequent steps. required: false default: '' cache: @@ -149,13 +150,14 @@ runs: ANDROID_CLI_FRESH_INSTALL=1 android --version echo "::endgroup::" - - name: Configure ANDROID_HOME + - name: Configure ANDROID_HOME and ANDROID_SDK_ROOT shell: bash env: SDK_PATH: ${{ steps.platform.outputs.sdk-path }} run: | set -euo pipefail echo "ANDROID_HOME=$SDK_PATH" >> "$GITHUB_ENV" + echo "ANDROID_SDK_ROOT=$SDK_PATH" >> "$GITHUB_ENV" # Also export common adjacent PATH entries so later steps can call # adb / emulator without setting PATH themselves. These are only # populated once their packages are installed.