Short answer
The Java version building your app is newer than your project’s Gradle version can handle. Flutter builds with the Java bundled with Android Studio, so an Android Studio update can trigger it. Run flutter analyze --suggestions to see which of AGP, Java and Gradle don’t fit together, then update the Gradle wrapper to the suggested version, or set the Java version Flutter uses with flutter config --jdk-dir.
What changed, and the fix
01
Java got newer, Gradle didn’t
“This is an indication that your Java version is newer than the version of Gradle you are running can handle.” Flutter, Android Java Gradle migration guide
The error means the Java running your build is newer than your Gradle can handle. Flutter’s guide notes the versions of AGP, Java and Gradle depend on each other in ways that aren’t obvious, so update them together.
02
Android Studio updated its bundled Java
“Flutter uses the version of Java bundled with Android Studio to build Android apps.” Flutter, Android Java Gradle migration guide
Flutter uses the Java that ships with Android Studio, so updating Android Studio can change the Java version under your build without any change to the project. Run flutter doctor to see which Java is in use.
flutter doctor03
Fix it: update Gradle to the suggested version
“Run flutter analyze --suggestions to see if your AGP, Java, and Gradle versions are compatible.” Flutter, Android Java Gradle migration guide
Flutter’s guide calls Android Studio’s AGP Upgrade Assistant the easiest way to resolve this: select your top-level build.gradle, then Tools > AGP Upgrade Assistant. From the command line, ask Flutter which versions fit, then update Gradle to the version it suggests (or newer) from your project’s Android directory.
flutter analyze --suggestions cd android && ./gradlew wrapper --gradle-version=SOMEGRADLEVERSION04
Or: set the Java version Flutter uses
“To set the version of Java that all flutter projects use run flutter config --jdk-dir=SOMEJAVAPATH” Flutter, Android Java Gradle migration guide
Flutter’s guide also shows how to set the Java version all your Flutter projects use, so you can pick one your Gradle can run with. On a Mac, /usr/libexec/java_home -V lists the Java versions installed.
flutter config --jdk-dir=/path/to/your/jdk
Checked against the vendor’s docs on : 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 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.See scope and start
Related: Flutter Android build fails after AGP 9 · Flutter “applying Gradle plugin imperatively” error · Flutter pod install failed