# Flutter: Exception: Gradle task assembleDebug failed with exit code 1

**Code:** `Gradle task assembleDebug failed with exit code 1` · **Category:** Flutter / Dart · **Seen on:** Flutter, Android

`flutter run` / `flutter build apk` stopped because the Gradle build failed; the real cause is printed above this line.

## Meaning

This line only reports that Gradle failed. Scroll up to the first "FAILURE: Build failed with an exception" and "What went wrong" block, or rerun with `flutter run -v` / `./gradlew assembleDebug --stacktrace` in `android/` for the full trace. Typical causes are SDK/JDK/plugin version mismatches, missing licenses, network problems downloading dependencies, or Kotlin/AGP version conflicts.

## Common causes

- JDK/Gradle/AGP version mismatch
- compileSdk or minSdk conflicts
- Missing Android licenses or SDK components
- Network or proxy blocking dependency download
- Kotlin version incompatible with plugins

## Quick fix

1. Read the "What went wrong" block above this line
2. Run `cd android && ./gradlew assembleDebug --stacktrace`
3. Run `flutter clean`, then `flutter pub get`, then rebuild

## Detailed fix by platform

### Flutter

1. `flutter run -v 2>&1 | tee build.log` then search the log for "What went wrong"

## How to diagnose

1. **Cause** — What went wrong block?
2. **Versions** — JDK, Gradle, AGP aligned?
3. **Network** — Dependencies downloadable?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/flutter/gradle-assembledebug-failed)
