Skip to content
Latchkey

Android "Android resource linking failed" in CI

During processReleaseResources (or the debug equivalent) AAPT2 links the compiled resources and references. It fails when a referenced resource or attribute does not exist for the compile SDK, naming the file and the unresolved symbol.

What this error means

The build fails with "Android resource linking failed" followed by an AAPT error such as "error: resource style/Theme... not found" or "error: attribute ... not found".

Android
> Android resource linking failed
  ERROR:/home/runner/app/src/main/res/values/styles.xml:3:5-60: AAPT: error:
  resource android:attr/colorError not found.

Common causes

A referenced resource or attribute does not exist

A layout or style references a resource id, attribute, or theme that is misspelled, removed, or not declared.

The compile SDK is too low for an attribute

An attribute introduced in a newer platform is used while compileSdk targets an older one, so AAPT2 cannot resolve it.

How to fix it

Fix the unresolved reference

  1. Open the file and line AAPT names in the error.
  2. Correct the resource name, or define the missing resource.
  3. Re-run the resource task.
Terminal
./gradlew :app:processReleaseResources --stacktrace

Raise the compile SDK for new attributes

If the attribute exists only on a newer platform, bump compileSdk to one that defines it.

app/build.gradle.kts
android { compileSdk = 34 }

How to prevent it

  • Keep compileSdk high enough for the attributes you reference.
  • Catch resource typos with a local resource-processing build.
  • Remove references to resources you delete.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →