'How to change the Gradle version?

I would like to change the Gradle version to 3.5.1 according to the project version received from git using this eclipse.

So I changed the editing path for the system environment variable, but if you enter 'gradle -v' in cmd, only 4.4 appears.

I looked for various solutions on the Internet, but it didn't work out.

How can I change the version?

And how can I erase the existing version 4.4 completely? I tried to erase it, but it kept popping up even if I deleted all the related files.

gradle -v:

Image



Solution 1:[1]

First, you need to know where Gradle is installed on your device. You can type where gradle in your terminal and the path will pop up.

Then, after you deleted the old version, go to the download page to download version 3.5.1. After download, follow the instructions in Installing manually in the Gradle installation guide.

Make sure that the old version is not included in your environment variables. If so, remove the old version and add the new one.

You can check Windows path variable by typing echo %PATH% in CMD.

Solution 2:[2]

One of the easiest way to change the gradle version is using sdkman. Install the required version you want and change whenever you want. Then hit

  • sdk install gradle <versionId>
  • sdk use gradle <versionId>

To check the list of versions installed

  • sdk list gradle

Solution 3:[3]

Using Gradle Wrapper

To quote the manual:

If your existing Gradle-based build uses the Gradle Wrapper, you can easily upgrade by running the wrapper task, specifying the desired Gradle version:

./gradlew wrapper --gradle-version=7.4.2 --distribution-type=bin

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 thokuest
Solution 2 Deepak Chandh
Solution 3 Basil Bourque