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
I get same error after update to AS 3.1.2. You can still use Gradle version 4.6 but downgrade Android gradle plugin to 3.1.1
EDIT: just invalidate cache and restart