Skip to content

Flutter Android build error

Flutter: “Gradle task assembleDebug failed with exit code 1”

flutter run on Android stops with Gradle task assembleDebug failed with exit code 1. That line only says the Android build failed. The reason is printed above it: a Java version Gradle can’t handle, a broken build file, a plugin that needs a newer Android setup, or a missing SDK. Whatever the first error names is the one to fix. Here’s how to find it, in Gradle’s and Flutter’s words, or hand it over at a fixed price.

Rather hand it over? App Fix Ticket: One reproducible bug in an existing mobile or web app, diagnosed and fixed.The Fix is $1,200 in total. The $450 Diagnosis is optional and credited toward it.

Full refund if Simon can’t take it on once he sees your project, or if you cancel before work starts. Refund terms.

Short answer

Scroll up from the exit line to the first error, or run flutter run -v to see the full Gradle output. If it mentions Java or an unsupported class file version, run flutter doctor to see which Java is in use, and flutter analyze --suggestions from the project folder to check that Java, Gradle and the Android Gradle plugin fit together. If it points at a build file, run ./gradlew help in the android folder to check the build scripts on their own.

Rather not fix it yourself? App Fix Ticket fixes one reproducible bug at a fixed price, with an optional Diagnosis that is credited toward the fix.

Find the real error, then fix it

  1. 01

    The exit line is a wrapper

    Flutter reports the Gradle task that failed, not why. The reason is a few lines above, after “What went wrong”. Run with -v for the whole log, or build from the android folder to see Gradle’s own output.

    flutter run -v
    
    cd android
    ./gradlew assembleDebug
  2. 02

    Java and Gradle don’t match

    “To find the Java version being used run flutter doctor.” Flutter, Android Java Gradle migration guide

    An Unsupported class file major version error means Gradle is too old for the Java that builds the app. Check which Java Flutter uses first, then let Flutter check the versions. The full steps are on the class file version page linked below.

    flutter doctor
    flutter analyze --suggestions
  3. 03

    JAVA_HOME points at the wrong place

    “Make sure that a Java Development Kit version 17 or higher is properly installed, the JAVA_HOME environment variable is set, and Java is on your PATH.” Gradle, Troubleshooting builds

    Gradle run directly, for example ./gradlew from the android folder or on a CI runner, uses JAVA_HOME. If the error says JAVA_HOME is set to an invalid directory, point it at an installed JDK. To choose the JDK Flutter itself uses, run flutter config --jdk-dir.

  4. 04

    A build file is broken

    “The help task does no work of its own, so if it fails, the problem is in your build scripts, settings, init scripts, or plugins.” Gradle, Troubleshooting builds

    A bad edit to build.gradle, settings.gradle or gradle.properties fails every build the same way, even when ./gradlew --version works. Run gradle help through the wrapper to check the scripts without building.

    cd android
    ./gradlew help

Checked against the vendor’s docs on : Gradle User Manual: Troubleshooting builds; Flutter docs: Android Java Gradle migration guide.

Rather hand it over?

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

“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
A buyer in the United States, July 2022. Shopify on Fiverr
Read 126 of the 127 Fiverr reviews

Related: Flutter unsupported class file major version · Flutter MissingPluginException · Flutter pod install failed · Expo EAS Build failed

Questions

More on this error

It builds in Android Studio but fails in the terminal. Why?

They can use different Java versions. Flutter builds with the Java bundled with Android Studio, or the one set with flutter config --jdk-dir, while ./gradlew run by hand uses JAVA_HOME. Run flutter doctor to see which Java Flutter uses.

Will flutter clean fix it?

Only when stale build files are the cause. Read the first error first; a Java, Gradle or build-file problem comes back after a clean.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it. If you already know the cause, you can pay for the fix directly; if not, start with a written diagnosis, which is credited toward 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.

A different error?

Ask Simon for a price range

Send the error and what you were doing. Simon replies by email, usually within one business day, with a price range.