Skip to content
Latchkey

Android "Failed to install SDK packages (licenses not accepted)" in CI

Gradle wants to install SDK packages but cannot because the corresponding license agreements have not been accepted on the runner.

What this error means

The build fails with Failed to install the following Android SDK packages as some licences have not been accepted, listing the packages. CI never accepted the licenses.

gradle
Failed to install the following Android SDK packages as some licences have not been accepted.
  platforms;android-34 Android SDK Platform 34
  build-tools;34.0.0 Android SDK Build-Tools 34

Common causes

Licenses not accepted on a fresh runner

License acceptance is stored on disk; a clean runner has none accepted.

Missing license-accept step before the build

The job tried to build before running sdkmanager --licenses.

How to fix it

Accept licenses with sdkmanager

  1. Run sdkmanager --licenses and accept them non-interactively before building.
shell
yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --licenses
./gradlew assembleDebug

Use a setup action that accepts licenses

An Android setup action can install the SDK and accept licenses in one step, keeping the job declarative.

How to prevent it

  • Accept licenses in a setup step or use a preinstalled SDK image. The download of SDK packages and the license metadata fetch are network calls. On Latchkey managed runners, self-healing auto-retries these transient downloads so a flaky fetch does not fail the job.

Frequently asked questions

What causes ""licenses not accepted""?
License acceptance is stored on disk; a clean runner has none accepted.
How do I fix "licenses not accepted"?
Accept licenses with sdkmanager

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card