9

Configuration on demand is not supported by version 3.1.2 of the Android Gradle plugin when using Gradle version 4.6 or above.

gradle Configuration on demand was pretty useful when working with multi-module android projects with lots of modules, to avoid unnecessary configuration.

I cannot find official release notes/documentation that explains the reason why configuration on demand is not supported by the latest android plugin. Does anyone have a better understanding of why it does not work and maybe what are the plans for the future? (eg, is this just a temporary bug?) is there any official documentation about this change?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • related (not duplicate): https://stackoverflow.com/questions/49990933/configuration-on-demand-is-not-supported-by-the-current-version-of-the-android-g – Toris May 13 '18 at 23:41

3 Answers3

6

First Remove org.gradle.configureondemand from gradle.properties.

then In Android Studio, For Mac go to the Preferences > Build, Execution, Deployment > Compiler and uncheck the configure on demand. For Linux/Windows go to the File > Settings > Build, Execution, Deployment > Compiler and uncheck the configure on demand.

Note, there are 2 gradle.properties files

In your project gradle.properties ~/.gradle/gragle.properties

  • 3
    Thank you for your comment. However, it's not related to my question. I know exactly how to disable it. The question was not about disabling this option, but to understand better whether this option will be supported any time in the future. It's an important optimisation when working with multi module projects with many modules, and since i disable it the build times are slightly worst – alessandro candolini May 15 '18 at 08:49
4

The reason why configuration on demand has been "removed" is to avoid unpredictable build error.

You still use gradle 4.4 though.

See Known issue about Android Studio

Configuration on demand with Gradle 4.6: If you're using either Android Plugin for Gradle 3.0.1 or 3.1.0 with Gradle 4.6, you should disable configuration on demand in your gradle.properties file, as shown below, to avoid some unpredictable build errors. This issue should be fixed in a future version of the plugin.

org.gradle.configureondemand=false

Community
  • 1
  • 1
xiaomi
  • 6,553
  • 3
  • 29
  • 34
  • NB: "Configuration on demand is not supported" error was not displayed with Android Plugin for Gradle 3.1.1 or less with Gradle 4.6 or above. (I've tried 3.0.1, 3.1.0 and 3.1.1), so it seems to depend on plugin version, not gradle version. – Toris May 14 '18 at 00:15
  • Thank you for your answer, this (and in particular the link https://developer.android.com/studio/known-issues) answers my question: it looks like it's a bug that should be fixed in some of the later versions of the plugin (finger crossed) – alessandro candolini May 15 '18 at 08:51
0

Goto File -> Settings -> Build, Excecution, Deployment -> Compiler and uncheck Configure on Demand.

NOTE: I am using Android Gradle com.android.tools.build:gradle:3.1.4 and Gradle 4.10.2 (check in File -> Project Structure -> Project).

  • Thank you for your answer. It's not answering my question though. I know exactly how to disable this, either from gradle (i don't use android studio at all these days to be honest) or from intellij/AS. The question was not about disabling this option, it was about understanding better whether this option will be supported againin the future. i want to be able to CHECK (not to uncheck) this option, this is an important optimisation when running multi-module projects (my android projects have 50+ different modules) and the android gradle plugin is breaking support for configuration on demand – alessandro candolini Mar 11 '19 at 23:23