After upgrading to Android Studio 3.1.2 I am getting the following error:
Configuration on demand is not supported by the current version of the Andro
It is already known bug in Android studio even in the Documentation, They have mentioned about this Problem.
The easiest way right now is to disable this feature by going
Check this Image for warning they have provided for specific Gradle plugin versions.