[gradle-server] Could not run build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.4.1-bin.zip'

I’m not a season programmer and just recently learned about gradle. I keep getting this error message. I’ve set the following Environment variables:

C:\Program Files\gradle-7.4.1

and the path to
C:\Program Files\gradle-7.4.1\bin

I did similar set for my java jdk path and home but still keep getting the Gradle-server error. any help would greatly be appreciated.

Thank you

What is “gradle-server”?
What do you invoke?
What full error do you get, including stack trace?

Actually to run a build you should never need to have any Gradle version installed.
Imho each Gradle build that does not contain the four wrapper files has a bug.
I even start new Gradle projects using the wrapper of existing Gradle projects and never have Gradle installed manually but exclusively use it through the wrapper.