Unable to find method 'org.gradle.api.internal.artifacts.configurations.ConfigurationInternal.getModule()

Hi All,

Am working on building a library module in Android using Android Studio. This was working fine and then on updating gradle plugin version and distributionUrl, am getting the following error.

Unable to find method ‘org.gradle.api.internal.artifacts.configurations.ConfigurationInternal.getModule()Lorg/gradle/api/internal/artifacts/ModuleInternal;’.

Possible causes for this unexpected error include:

Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Even after trying all the options - restarting, invalidating cache, killing java process, clearing .gradle folder and other solutions, the error remains

Note: Am running Android Studio 3.1.2 on mac OS X - Gradle plugin version 3.1.2 (issue is reproducible in versions 3.0.1 & 2.3.3) and distributionUrl = “https://services.gradle.org/distributions/gradle-4.4-all.zip” (reproducible in 4.1 also).

Any help would be appreciated ! TIA !!