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 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
- Open the file and line AAPT names in the error.
- Correct the resource name, or define the missing resource.
- Re-run the resource task.
./gradlew :app:processReleaseResources --stacktraceRaise the compile SDK for new attributes
If the attribute exists only on a newer platform, bump compileSdk to one that defines it.
android { compileSdk = 34 }How to prevent it
- Keep
compileSdkhigh enough for the attributes you reference. - Catch resource typos with a local resource-processing build.
- Remove references to resources you delete.