Manually edit the gradle/wrapper/gradle-wrapper.properties
file and put the desired version number in the line:
distributionUrl=https://services.gradle.org/distributions/gradle-X.X.x-all.zip
Then issue:
$ ./gradlew wrapper --gradle-version X.X.x --distribution-type all