Upgrade Gradle 4.0

I am working in Andriod Studio 3.6.1. I need to update from Gradle 4.0 to at least Gradle 5.6.4. Step 2 of 7 in an article on docs.gradle.org (https://docs.gradle.org/current/userguide/upgrading_version_4.html#changes_4.1) involves running gradle help --scan. Running this command yields this error:

Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\ibwev\AndroidStudioProjects\RentCollection\app\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.internal.version-check']
   > Minimum supported Gradle version is 5.6.4. Current version is 4.0. If using the gradle wrapper, try editing the distributionUrl in C:\Users\ibwev\AndroidStudioProjects\RentCollectio
n\gradle\wrapper\gradle-wrapper.properties to gradle-5.6.4-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 BUILD FAILED in 17s

“distributionUrl” was already set to the minimum supported Gradle version of 5.6.4:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

File\ProjectStructure\Project has 3.6.1 selected as the Android Gradle Plugin and 5.6.4 selected as the Gradle Version. gradle -v yields:

C:\Users\ibwev\AndroidStudioProjects\RentCollection>gradle -v

------------------------------------------------------------
Gradle 4.0
------------------------------------------------------------

Build time:   2017-06-14 15:11:08 UTC
Revision:     316546a5fcb4e2dfe1d6aa0b73a4e09e8cecb5a5

Groovy:       2.4.11
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_201 (Oracle Corporation 25.201-b09)
OS:           Windows 10 10.0 amd64

Sorry for the elementary question but how do I upgrade from Gradle 4.0 to at least Gradle 5.6.4?

The problem is that the Android plugin is doing a check on the Gradle version. But what step 2 means is that you should run with --scan on your current Gradle version to see what deprecated APIs you are using. If for some reason --scan doesn’t work, it also says:

Alternatively, you could run gradle help --warning-mode=all to see the deprecations in the console, though it may not report as much detailed information.

Thank you for replying.

The problem is that the Android plugin is doing a check on the Gradle version

Does this mean I need to stop the Android plugin from doing a check on the Gradle version? If so, how do I do that? My main goal is to generate a Signed APK. Any help resolving this problem would be much appreciated.

Please reference this link for solution that worked for me.