Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Configuration on demand is not supported by the current version of the Gradle plugin?

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?

like image 918
alessandro candolini Avatar asked May 03 '18 13:05

alessandro candolini


People also ask

How do I change the current version of Gradle?

You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or update your Gradle version using the command line. The preferred way is to use the Gradle Wrapper command line tool, which updates the gradlew scripts.

How do I check my current Gradle version?

In Android Studio, go to File > Project Structure. Then select the "project" tab on the left. Your Gradle version will be displayed here.

Which Gradle version is compatible with Java 17?

Support for Java 17 As of Gradle 7.3, both running Gradle itself and building JVM projects with Java 17 is fully supported.


2 Answers

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

like image 143
Mostafa Pirhayati Avatar answered Oct 23 '22 02:10

Mostafa Pirhayati


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

like image 24
xiaomi Avatar answered Oct 23 '22 00:10

xiaomi