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?
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.
In Android Studio, go to File > Project Structure. Then select the "project" tab on the left. Your Gradle version will be displayed here.
Support for Java 17 As of Gradle 7.3, both running Gradle itself and building JVM projects with Java 17 is fully supported.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With