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
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
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 --stacktrace02
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) }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 }04
mergeDebugResources, processDebugMainManifest or mergeDexDebug
“When one failure wraps another, the underlying cause is prefixed with >.” Gradle, Troubleshooting builds
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 : Gradle: Troubleshooting builds.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA 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
Related: Android “Duplicate class” build error · Android “Manifest merger failed” · Flutter “Gradle task assembleDebug failed”