Actually, the right solution is to not even try. :-)
In 98.7% of the cases you should not use and locally installed version, but use the Gradle Wrapper to run builds.
Only if you want to bootstrap a new build without any Gradle supporting IDE at hand and without any other project the wrapper of which you could use, you need it, or to run builds that do not include the 4 wrapper files which imho is a build bug.