# Gradle: “Execution failed for task ':app:...'”

> Execution failed for task :app:compileDebugKotlin, mergeDebugResources or checkDebugAarMetadata. Read the cause under What went wrong and fix that task.

Canonical: https://app369.com/fix/android-execution-failed-for-task/
Last updated: 2026-11-08

An Android build stops with FAILURE: Build failed with an exception, then Execution failed for task ':app:compileDebugKotlin' (or mergeDebugResources, checkDebugAarMetadata, processDebugMainManifest, mergeDexDebug). The line itself only names the step that broke. The real cause is in the lines below it, and the task name tells you where to look.

**Short answer**

Scroll to What went wrong and read the indented lines under the task name; the last > line is usually the real cause. Run ./gradlew assembleDebug --stacktrace for the full detail. Then match the task: compile tasks mean a code or JDK/Kotlin version problem, merge and process resource tasks mean a broken resource or manifest, checkDebugAarMetadata means a library needs a higher compileSdk (or a newer Android Gradle Plugin), and mergeDex tasks mean a D8 dexing error such as the 64K method limit.

## **What the failing task tells you, and the fix**

1. 01 ### **Read the cause, not the task name**
  > “A message that starts with Execution failed for task means the failure happened while running that task, not while configuring the build.” [**Gradle, Troubleshooting builds**](https://docs.gradle.org/current/userguide/troubleshooting.html) Gradle prints the failing task first and nests the underlying error under it. Read to the deepest line, and rerun with --stacktrace or --info when the message is cut short.```
./gradlew assembleDebug --stacktrace
# Windows: gradlew.bat assembleDebug --stacktrace
```
2. 02 ### **compileDebugKotlin or compileDebugJavaWithJavac** A real compile error in your code or a plugin, or a version mismatch: Android Gradle Plugin 8 needs JDK 17 or newer, and Java and Kotlin must target the same JVM version. Point Android Studio’s Gradle JDK at JDK 17 or 21 and set one target for both. The kotlin block sits at the top level of the module’s build.gradle.kts, outside android, and jvmToolchain needs JDK 17 installed or a toolchain resolver plugin.```
android {
  compileOptions {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
  }
}
kotlin { jvmToolchain(17) }
```
3. 03 ### **checkDebugAarMetadata** A dependency was built against a newer Android API than your compileSdk. The message names the library and the version it needs. Raise compileSdk (not minSdk) to at least that version. A higher compileSdk, or the library itself, can also need a newer Android Gradle Plugin; the message says which version.```
android {
  compileSdk = 36
}
```
4. 04 ### **mergeDebugResources, processDebugMainManifest or mergeDexDebug**
  > “When one failure wraps another, the underlying cause is prefixed with >.” [**Gradle, Troubleshooting builds**](https://docs.gradle.org/current/userguide/troubleshooting.html) Resource tasks fail on a bad XML file, an invalid file name in res/, or a duplicate resource; manifest tasks fail on merge conflicts; dex tasks fail on D8 errors such as the 64K method limit (duplicate classes usually fail earlier, in checkDebugDuplicateClasses). The nested message names the file or class, so fix that one.

Checked against the vendor’s docs on November 8, 2026: [Gradle: Troubleshooting builds](https://docs.gradle.org/current/userguide/troubleshooting.html).

## **Rather hand it over?**

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

- [from $450**App Fix Ticket**One reproducible bug in an existing mobile or web app, diagnosed and fixed.**See scope and start**](https://app369.com/fixed-price/flutter-firebase-bug-fix/)
- [from $450**AI-Built App Rescue**A Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.****No issues worth fixing, no charge.**** If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.**See scope and start**](https://app369.com/fixed-price/ai-app-rescue/)

Related: [**Android “Duplicate class” build error**](https://app369.com/fix/android-duplicate-class/) · [**Android “Manifest merger failed”**](https://app369.com/fix/android-manifest-merger-failed/) · [**Flutter “Gradle task assembleDebug failed”**](https://app369.com/fix/flutter-gradle-assembledebug-failed/)

Questions

## **More on this error**

<details>

<summary>**Does ./gradlew clean fix it? **+</summary>

Only when the failure comes from stale build output, which is rare. Read the cause first; clean builds take longer and usually fail the same way.

</details>

<details>

<summary>**It builds in Android Studio but fails in CI. Why? **+</summary>

Usually a different JDK or missing environment: CI uses its own Java version, Android SDK packages and signing setup. Print java -version and the Gradle JDK in the CI log and match them to your machine.

</details>

<details>

<summary>**Can you fix it for me? **+</summary>

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

</details>

A different error?

## **Describe it and get a written quote**

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.

[**Describe your problem **→](https://app369.com/contact/) [**All fixes**](https://app369.com/fix/)