Gradle task assembleDebug failed with exit code 1 Flutter / Dart Origin: On your device OSI layer 7 · Application Last updated 4 Nov 2026

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

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

Exact message you may see Gradle task assembleDebug failed with exit code 1Exception: Gradle task assembleDebug failed with exit code 1Gradle task assembleRelease failed with exit code 1Gradle build failed to produce an .apk fileError: Gradle task assembleDebug failed with exit code 1
Seen on: Flutter Android

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?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Android license status unknown / licenses not accepted — flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses (Flutter / Dart)Android license statu…Android resource linking failed — AAPT: error: resource x (aka y) not found — Android resource linking failed (Android)Android resource link…android:attr/lStar not found — AAPT: error: resource android:attr/lStar not found (Android)android:attr/lStar no…Cannot fit requested classes in a single dex file — Cannot fit requested classes in a single dex file (# methods: 65536 > 65536) — mergeDex failed (Android)Cannot fit requested …Cleartext HTTP traffic not permitted — Flutter (Android): java.io.IOException: Cleartext HTTP traffic to api.example.com not permitted (Flutter / Dart)Cleartext HTTP traffi…cmdline-tools component is missing — flutter doctor: Android SDK is missing command-line tools; download from https://goo.gl/XxQghQ — cmdline-tools component is missing (Flutter / Dart)cmdline-tools compone…Could not resolve — Gradle: Could not resolve all files for configuration / Could not resolve dependency (Android)Could not resolveDependency requires compileSdk — Dependency 'androidx.x:1.y' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Android)Dependency requires c…Gradle ta…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.