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

AndroidAndroid Gradle-Plugin

Android Problem Overview


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 Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6.

I attempted following the suggestion but this did not fix the issue. Any ideas? All help is greatly appreciated, thank you.

Android Solutions


Solution 1 - Android

No need to downgrade!

Disabling configure on demand requires two steps:

  1. Remove org.gradle.configureondemand from gradle.properties.

  2. 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

  1. In your project gradle.properties
  2. ${HOME}/.gradle/gradle.properties

Solution 2 - Android

In Android Studio, just go to File -> Settings -> Build, Execution, Deployment -> Compiler and click to uncheck the configure on demand option, then click Ok and Sync Project with gradle files again.

Solution 3 - Android

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

Solution 4 - Android

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

  1. Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
  2. In the left pane, click Build, Execution, Deployment > Compiler.
  3. Un check the Configure on demand checkbox.
  4. Click Apply or OK.

Check this Image for warning they have provided for specific Gradle plugin versions.

enter image description here

Solution 5 - Android

Other 'solution' is use the suggestion by Android Studio. Plugin Android Gradle 3.1.3 and Gradle version 4.4.

enter image description here

Solution 6 - Android

From Android Studio uncheck the configure on demand:

Follow below steps:

  1. For Mac go to the Preferences > Build, Execution, Deployment > Compiler and uncheck the configure on demand.

  2. For Linux/Windows go to the File > Settings > Build, Execution, Deployment > Compiler and uncheck the configure on demand.

Now sync your project

Happy coding! :)

Solution 7 - Android

The @wookupmaker answer is correct. But, if it still doesn't work, the problem migh be a global gradle.properties.

Even if I tried to override

> org.gradle.configureondemand=false

in my local(project specific) gradle.properties, somehow it did not work.

After editing global (~/.gradle/gradle.properties) it worked as expected

Solution 8 - Android

Just you need to update Android Gradle Plugin update to 3.2.0-alpha16.

Android Gradle Plugin update 3.2.0-alpha16 instead of 3.1.2

Solution 9 - Android

Invalidate cache and restart/disabling configure on demand did not work for me. The only solution that helped me is to import the project from git again.

[UPD] Need to change "com.android.tools.build:gradle" from 3.1.2 to 3.1.1

Solution 10 - Android

All I needed to do in this case was to use "nuclear function" in Android Studio:

File -> Invalidate Caches / Restart....

Like in many other cases, this helped to make Gradle sync and project build working again. I'm using gradle-4.6-all and Gradle Plugin com.android.tools.build:gradle:3.1.3.

Solution 11 - Android

Go to File->Build,Excution,Deployment->Compiler and Uncheck Configure on Demand

enter image description here

Solution 12 - Android

gradle/wrapper/gradle-wrapper.properties

Update the gradle version

distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip

Build > Rebuild Project

Good Luck

Source

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDick LucasView Question on Stackoverflow
Solution 1 - Androiduser5484179View Answer on Stackoverflow
Solution 2 - AndroidSidonaiView Answer on Stackoverflow
Solution 3 - AndroidHanhanView Answer on Stackoverflow
Solution 4 - AndroidTapanHPView Answer on Stackoverflow
Solution 5 - AndroidAlex FelipeView Answer on Stackoverflow
Solution 6 - AndroidMonir ZzamanView Answer on Stackoverflow
Solution 7 - AndroidBozic NebojsaView Answer on Stackoverflow
Solution 8 - AndroidChetan PatelView Answer on Stackoverflow
Solution 9 - AndroidwhitipetView Answer on Stackoverflow
Solution 10 - AndroidMicerView Answer on Stackoverflow
Solution 11 - AndroideliView Answer on Stackoverflow
Solution 12 - AndroidBraian CoronelView Answer on Stackoverflow