androidandroid-studio

Gradle: "Configuration cache state could not be cached"


Configuration cache state could not be cached: field 'actions' from type 'org.gradle.api.DefaultTask': error writing value of type 'java.util.ArrayList'
> Configuration cache state could not be cached: field 'closure' from type 'org.gradle.api.internal.AbstractTask$ClosureTaskAction': error writing value of type 'com.chaquo.python.PythonPlugin$_createAssetsTasks_closure21$_closure46'
   > Configuration cache state could not be cached: field 'variant' from type 'com.chaquo.python.PythonPlugin$_createAssetsTasks_closure21$_closure46': error writing value of type 'groovy.lang.Reference'
      > Configuration cache state could not be cached: field 'value' from type 'groovy.lang.Reference': error writing value of type 'com.android.build.gradle.internal.api.ApplicationVariantImpl'
         > Configuration cache state could not be cached: field 'testVariant' from type 'com.android.build.gradle.internal.api.ApplicationVariantImpl': error writing value of type 'com.android.build.gradle.internal.api.TestVariantImpl'
            > Configuration cache state could not be cached: field 'variantData' from type 'com.android.build.gradle.internal.api.TestVariantImpl': error writing value of type 'com.android.build.gradle.internal.variant.TestVariantData'
               > Configuration cache state could not be cached: field 'testedVariantData' from type 'com.android.build.gradle.internal.variant.TestVariantData': error writing value of type 'com.android.build.gradle.internal.variant.ApplicationVariantData'
                  > Configuration cache state could not be cached: field 'artifacts' from type 'com.android.build.gradle.internal.variant.ApplicationVariantData': error writing value of type 'com.android.build.api.artifact.impl.ArtifactsImpl'
                     > Configuration cache state could not be cached: field 'storageProvider' from type 'com.android.build.api.artifact.impl.ArtifactsImpl': error writing value of type 'com.android.build.api.artifact.impl.StorageProviderImpl'
                        > Configuration cache state could not be cached: field 'fileStorage' from type 'com.android.build.api.artifact.impl.StorageProviderImpl': error writing value of type 'com.android.build.api.artifact.impl.TypedStorageProvider'
                           > Configuration cache state could not be cached: field 'singleStorage' from type 'com.android.build.api.artifact.impl.TypedStorageProvider': error writing value of type 'java.util.LinkedHashMap'
                              > java.util.ConcurrentModificationException (no error message)

This is the error message I am receiving while synchronizing with the gradle please help me solving this issue


Solution

  • In the file gradle.properties there is a line of code org.gradle.unsafe.configuration-cache=true Delete it and rebuild the project, it will solve the problem.

    This occurred due to the configuration cache of Gradle. Some libraries are not cacheable so it gives the error .