Skip to content

premex-ab/setup-android-cli

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

setup-android-cli

CI

A GitHub Action that installs Google's agent-first android CLI, sets up the Android SDK, and caches between runs. Drop-in replacement for setup-android with a simpler, faster setup.

Why switch?

setup-android setup-android-cli
Download size ~300 MB (cmdline-tools zip) ~5 MB (single binary)
Install Unzip + accept licenses + sdkmanager curl one binary
Package syntax "platforms;android-34" (semicolons) platforms/android-34 (slashes)
License prompt yes | sdkmanager --licenses Auto-accepted, non-interactive
Action type JavaScript (Node 20, bundled) Composite (pure YAML + shell)
Version tracking Pin a cmdline-tools build number Always installs the current CLI release

Usage

Basic

steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: '21'
  - uses: premex-ab/setup-android-cli@v1
    with:
      packages: platform-tools
  - run: ./gradlew --no-daemon build

Multiple packages

  - uses: premex-ab/setup-android-cli@v1
    with:
      packages: |
        platforms/android-34
        build-tools/34.0.0
        platform-tools

CLI only (no SDK packages)

  - uses: premex-ab/setup-android-cli@v1
  - run: android --version

Custom SDK path

  - uses: premex-ab/setup-android-cli@v1
    with:
      sdk-path: /opt/android-sdk
      packages: platforms/android-34 build-tools/34.0.0 platform-tools

Disable caching

  - uses: premex-ab/setup-android-cli@v1
    with:
      cache: 'false'
      packages: platform-tools

Inputs

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.
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.
install-url-base Google redirector Override download URL base (for mirrors / air-gap).

Outputs

Output Description
sdk-path Absolute path to the installed Android SDK.
cli-version Version string from android --version.
cache-hit Whether the cache was restored (true/false, empty if caching disabled).

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.
  4. Runs android sdk install <packages> if packages are specified.
  5. Registers Gradle, Kotlin, and Android Lint problem matchers so build errors show inline in the GitHub UI.
  6. Writes a job summary table with CLI version, SDK path, and cache status.

Supported runners

Runner Status
ubuntu-latest / ubuntu-22.04 Supported
macos-latest / macos-14 (Apple Silicon) Supported
macos-13 (Intel, Rosetta) Best-effort (warning emitted)
windows-* Not yet supported (the CLI itself has limited Windows support)
Self-hosted Linux x86_64 / macOS arm64 Supported

Caching

By default the action caches ~/.android/bin (CLI resources, ~78 MB) and the full SDK directory between runs. The cache key includes OS, architecture, and the hash of **/libs.versions.toml, **/build.gradle*, and **/settings.gradle* so it busts when your project's SDK requirements change.

Gradle caching is not handled by this action. Use gradle/actions/setup-gradle@v4 for that.

Migrating from setup-android

 - name: Setup Android SDK
-  uses: android-actions/setup-android@v3
-  with:
-    packages: 'tools platform-tools'
+  uses: premex-ab/setup-android-cli@v1
+  with:
+    packages: platform-tools

Key differences:

  • No cmdline-tools-version input (always current release).
  • No accept-android-sdk-licenses input (auto-accepted).
  • Package names use slashes instead of semicolons: platforms/android-34 not "platforms;android-34".
  • tools package doesn't exist in the new CLI; drop it.

Problem matchers

This action registers problem matchers for:

  • Android Lint warnings and errors
  • Gradle build errors
  • Kotlin compiler warnings and errors

These surface build issues as inline annotations in the GitHub UI.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors