grb
grb

Reputation: 1

My project's Gradle version is incompatible with the Java version Flutter uses for Gradle

First I want to say that I wanted to run a flutter program on my cell phone that was connected by USB to my PC, but the following appeared in the console:

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

To fix this issue, consult the migration guide at docs.flutter.dev/go/android-java-gradle-error.

What you're looking for means that the versions of java or gradle you use are incompatible.

----------------------------SOLUTION----------------------------

The Gradle version change ended up working for me, since I have version 20 of Java and the one compatible with it is Gradle 8.1 to 8.3 based on what was said on the following compatibility page -pagina-

There is also a page with a description and indications in each version of Gradle's compatibility with Java-pagina-

Taking that into account, you should know what version of Java you have to compare them on the previous pages and verify which version of Gradle will work for you. In my case, I have Java version 20 and I had Gradle 7.5, which did not work for me and would not let me. run the program so I changed to gradle version 8.2 and it worked normally.

To change the version of the Flutter program, you must enter the following sections:

imagen de explorador de visual studio code In that section of the explorer open the folder called android

imagenInside the android folder you must open gradle and finally the gradle-wrapper.properties file where the link to the gradle version is located:

distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip

The last line is the link that must be changed, from 7.5 I changed it to 8.2 (gradle version compatible with my version of java), leaving it like this:

distributionUrl=https://services.gradle.org/distributions/gradle-8.2-all.zip

I hope it can be useful to someone

Upvotes: 0

Views: 3162

Answers (1)

Abdelrahman Tareq
Abdelrahman Tareq

Reputation: 2297

I have just hit the same issue - my resolution was a little simpler:

Just like you, I have Android Studio installed, the key is to install Android SDK Command-line Tools, steps being:

Open Android Studio

  1. Tools Menu, SDK Manager
  2. In the window that comes up there are inner panels, choose SDK Tools panel
  3. Tick Android SDK Command-line Tools
  4. Choose Apply button near the bottom of the window
  5. At that point, you will be prompted to accept the SDK license and the command line tools will be installed. Your license issue should now be resolved.

FYI, the command line tools will add a new folder cmdline-tools inside your SDK Folder. If you look in there cmdline-tools/latest/bin you will see sdkmanager - but your license issue should already be resolved.

thanks to Flutter doctor error - Android sdkmanager tool not found. Windows

Upvotes: 0

Related Questions