React Native

How to Resolve "Error: Task :app:processDebugResources Failed" in React Native

4 min read by DebuggedIt

Quick answer

An Android build fails at the resource-processing step, which is where Gradle compiles all your XML resources (strings, layouts, drawables, colors) into...

An Android build fails at the resource-processing step, which is where Gradle compiles all your XML resources (strings, layouts, drawables, colors) into Android's binary resource format. Unlike some more generic Gradle failures, this task's errors usually point fairly directly at the specific malformed resource file causing the problem.

The Problem

The build fails with a task-specific error, usually including at least a partial pointer to the actual problem:

$ npx react-native run-android
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

resource string/app_name not found.
error: failed processing manifest.

Sometimes it's more directly tied to a specific malformed XML file:

ERROR: /myapp/android/app/src/main/res/values/strings.xml:5: error: not well-formed (invalid token).

Why It Happens

The resource-processing task merges and compiles every XML resource file across your app and all its dependencies (including native modules), and it fails hard the moment it encounters something structurally invalid or a reference to a resource that doesn't actually exist anywhere in the merged set. Common causes:

  • Malformed XML — an unescaped special character (particularly &, which must be written as & in Android XML resource files), a missing closing tag, or invalid syntax in a strings, layouts, or colors file.
  • A missing resource reference — code or another resource file references a string, drawable, or style by name that doesn't actually exist anywhere in the resource set, often due to a typo or a resource that was deleted without updating its references.
  • Resource name conflicts between your app and a native module, similar in nature to the duplicate-resource issue that can also surface through a more generic Gradle failure, but here specifically caught during the linking phase.
  • An invalid or unsupported attribute value in a layout or style resource, especially after copying a snippet from a different Android SDK target version than your project uses.

The Fix

Read the full error carefully — this specific task usually names the exact file and line number, which makes it much more directly actionable than a generic Gradle failure:

cd android
./gradlew assembleDebug --stacktrace 2>&1 | grep -A 3 "error:"

For the "not well-formed" XML error, open the named file and check for unescaped special characters, which is by far the most common cause of this specific message:

<!-- Wrong: unescaped ampersand breaks XML parsing -->
<string name="terms">Terms & Conditions</string>

<!-- Correct -->
<string name="terms">Terms &amp; Conditions</string>

Other characters needing escaping in Android XML resources include <, >, and unescaped single/double quotes inside certain contexts:

<string name="quote">She said \"hello\"</string>
<string name="apostrophe">Don\'t worry</string>

For a "resource not found" error, search your project for any reference to the missing resource name and confirm it's actually defined somewhere in your resource files:

grep -rn "app_name" android/app/src/main/res/

If it's genuinely missing (deleted, renamed, or never added), add the missing definition:

<!-- android/app/src/main/res/values/strings.xml -->
<string name="app_name">My App</string>

For a resource naming conflict with a third-party native module, rename your own conflicting resource, since you can't modify a dependency's packaged resources directly:

<!-- Rename in your own strings.xml to avoid colliding with a library's resource -->
<string name="my_app_terms">Terms and Conditions</string>

Still Not Working?

If the error output doesn't clearly name a specific file, narrow it down by temporarily commenting out recently added or modified resource files one at a time and rebuilding, isolating exactly which change introduced the failure — this is tedious but reliable when the automatic error reporting isn't specific enough on its own:

cd android
./gradlew assembleDebug 2>&1 | tee build_error.log

Also double-check any resource files recently pulled in via git merge or git pull for merge conflict markers that were accidentally left in the file — a stray <<<<<<< HEAD line left behind in an XML file produces exactly this kind of "not well-formed" resource processing failure, and it's an easy thing to miss when reviewing a merge that otherwise looked clean:

grep -rn "<<<<<<<\|=======\|>>>>>>>" android/app/src/main/res/