Unable to build Android Project using Gradle

Just as soon as I upgraded my Android Gradle plugin to 3.4.0 and therefore incremented my Gradle version to 5.1.1 < . I have started to receive build errors.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().

Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().

Env : Java version 1.8

java version “1.8.0_181”
Java™ SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot™ 64-Bit Server VM (build 25.181-b13, mixed mode)