Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle sync failed after restarting android studio, Cannot convert string value 'ML_MODEL_BINDING'

Tags:

android

gradle

I did 'Invalidate Caches/Restart' in Android studio and then I got this error while syncing gradle.

Cannot convert string value 'ML_MODEL_BINDING' to an enum value of type 'com.android.builder.model.AndroidGradlePluginProjectFlags$BooleanFlag' (valid case insensitive values: APPLICATION_R_CLASS_CONSTANT_IDS, TEST_R_CLASS_CONSTANT_IDS, TRANSITIVE_R_CLASS, JETPACK_COMPOSE)

I am using gradle 4.1.0-alpha05

classpath 'com.android.tools.build:gradle:4.1.0-alpha05'

I have tried clean project, rebuild project, deleted the build files and restarted Android Studio. Nothing worked

Thanks in advance

like image 444
ZaidRehman Avatar asked Apr 15 '20 20:04

ZaidRehman


3 Answers

Had the same problem on IntelliJ 2020.1.3 .

What worked for me was updating gradle versions to the highest available:

in file build.gradle (project)

dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0-beta03'

in file gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
like image 146
Ivan Yulin Avatar answered Oct 06 '22 23:10

Ivan Yulin


I'm facing the same issue on my KMP project.

The problem is on AndroidGradlePluginProjectFlags.java they add JETPACK_COMPOSE and ML_MODEL_BINDING to the BooleanFlag enum, so probably somewhere in the build tools they are trying to access it but the plugin implementation does not have it yet.

I tried to use the Android Studio 4.1 Canary 6 and it works to my project, hopefully, it works to your need too.

As a reference, there is an issue on IntelliJ support site here.

like image 44
ademar111190 Avatar answered Oct 06 '22 23:10

ademar111190


Downgrading to 4.1.0-alpha02 got rid of the error.

Using Android Studio 4.1 Canary 2.

like image 30
Daniels Šatcs Avatar answered Oct 06 '22 22:10

Daniels Šatcs