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
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 assembleDebug02
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 --suggestions03
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.
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.
- from $450App Fix TicketOne reproducible bug. The Fix costs $1,200. If you need a Diagnosis first, its $450 fee counts toward the Fix.See scope and start
- from $450AI-Built App RescueFor a whole-app review, the $450 Launch Check is credited toward the optional $1,950 Rescue Sprint for up to five critical or high findings.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
“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
Related: Flutter unsupported class file major version · Flutter MissingPluginException · Flutter pod install failed · Expo EAS Build failed