Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Your project's Gradle version is incompatible with the Java version that Flutter is using for Gradle

i can't run my project and everytime i tried i receive a message telling me that

my project's Gradle version is incompatible with the Java version that Flutter is using for Gradle

i tried to change my gradle version to one compativble with the java version that my flutter project is using but it didn't work.

Based on the command line :

flutter doctor --verbose 

My java version is :

Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

i use android studio

enter image description here

like image 495
Kerby Elpenord Avatar asked Mar 11 '26 08:03

Kerby Elpenord


2 Answers

You should start with updating your gradle. As per compatibility matrix your project should use at least 8.5 version.

To update, there are several options:

  1. run updater in console with ./gradlew wrapper --gradle-version 8.5 or gradlew.bat wrapper --gradle-version 8.5 (windows) in project's android directory
  2. Update distributionUrl in gradle.properties (on the screenshot in the question) to distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip

After that make sure that version of AGP (com.android.application) is at least 8.3.2. But newer is better I guess.

After that build should work again.

like image 124
Sameri11 Avatar answered Mar 13 '26 23:03

Sameri11


Try deleting android folder to remove outdated configurations or incorrect settings then run

flutter create .

this will create new android folder with default settings based on your installed Flutter version. Then try running project

flutter run

like image 37
Silikazi Avatar answered Mar 13 '26 21:03

Silikazi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!