React Native Build Failure "Task :app:processDebugResources FAILED"
The :app:processDebugResources FAILED error is Gradle's generic wrapper around an underlying Android resource processing problem — the real cause is almost always further down in the build output, in a more specific error that this generic task failure is just the outer layer of.
The Problem
An Android build fails with:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> AAPT2 error: check logs for details
The message itself doesn't say what's actually wrong — it points to "check logs," and the genuinely useful detail is usually a few lines above or below this exact message, easy to miss in a long build output.
Why It Happens
This task is responsible for compiling and linking Android resources (XML layouts, drawables, strings, styles), and it fails whenever something in that resource compilation step is genuinely broken. Common underlying causes:
- Malformed XML in a resource file — a missing closing tag, invalid attribute, or duplicate resource ID defined in more than one place
- A resource name conflict between your app's own resources and a resource defined identically in a third-party library dependency, especially common after adding a new native module
- A stale Gradle or Android build cache holding onto outdated resource state that conflicts with recent changes
- An invalid or unsupported value in a resource file, such as an image referenced in XML that doesn't actually exist at the expected path, or a vector drawable using an XML feature not supported by your configured minimum SDK version
The Fix
First, run the build with more verbose output to see the actual underlying AAPT2 error, which is normally truncated in the default build output:
cd android
./gradlew assembleDebug --stacktrace
Scroll up from the generic failure message specifically looking for a line mentioning a file path and a specific XML or resource error — this is the real, actionable error, distinct from the generic task failure summary.
If the error points to a specific resource file, open it directly and check for XML syntax issues, especially after a recent manual edit:
xmllint --noout android/app/src/main/res/layout/your_file.xml
This validates the XML structure directly, quickly surfacing a malformed tag or attribute that might not be obvious just from reading the file visually.
If the error mentions a duplicate resource, search for the conflicting resource name across your project and dependencies:
grep -r "resource_name_here" android/
A duplicate often comes from two different libraries (or your app and a library) both defining a resource with the same name — renaming your own conflicting resource, or excluding the specific duplicate from one of the dependencies, resolves it depending on which side you have control over.
Clear Gradle's build cache, which resolves a meaningful fraction of confusing, seemingly-unrelated build failures that stem from stale cached state rather than an actual current problem:
cd android
./gradlew clean
rm -rf ~/.gradle/caches/
cd ..
npx react-native run-android
If the issue appeared right after adding a new native dependency, check that library's installation instructions carefully for any required manual Android configuration step (like adding a specific resource, permission, or Gradle configuration) that an automatic linking process might not have fully completed.
Still Not Working?
If the verbose output still doesn't clearly identify the specific resource causing the failure, bisect by temporarily commenting out or removing recently added resource files (or reverting to a known-working commit and reintroducing changes incrementally) to narrow down exactly which change introduced the failure — this is slower than reading a clear error message, but reliable when AAPT2's own error reporting doesn't clearly identify the specific problematic file or line in your specific case.