Got exception when run ./gradlew androidDependencies and enable configuration cache build together

Viewed 42

I setup the multimodule Hello world android project with AGP 7.0.2 and enable the configuration caching build by setting properies org.gradle.unsafe.configuration-cache=true in gradle.properties file

I can successfully run it in Android Studio, however when i tried to run gradle task ./gradlew androidDependencies , i got error and the following is the error stacktraces. As workaround i will run ./gradlew androidDependencies -Dorg.gradle.unsafe.configuration-cache=true at the moment

The functionality is great for android development so i would like to enable it for the team

Appreciate any comments or advice on it. Thanks a lot


FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache state could not be cached: field 'testComponents' from type 'com.android.build.gradle.internal.tasks.DependencyReportTask': error writing value of type 'java.util.ArrayList'
> Configuration cache state could not be cached: field 'delegate$delegate' from type 'com.android.build.api.component.impl.AndroidTestImpl': error writing value of type 'kotlin.SynchronizedLazyImpl'
   > Configuration cache state could not be cached: field 'value' from type 'kotlin.InitializedLazyImpl': error writing value of type 'com.android.build.api.component.impl.AndroidTestCreationConfigImpl'
      > Configuration cache state could not be cached: field 'globalScope' from type 'com.android.build.api.component.impl.AndroidTestCreationConfigImpl': error writing value of type 'com.android.build.gradle.internal.scope.GlobalScope'
         > Configuration cache state could not be cached: field 'extension' from type 'com.android.build.gradle.internal.scope.GlobalScope': error writing value of type 'com.android.build.gradle.internal.dsl.BaseAppModuleExtension'
            > Configuration cache state could not be cached: field 'publicExtensionImpl' from type 'com.android.build.gradle.internal.dsl.BaseAppModuleExtension': error writing value of type 'com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated'
               > Configuration cache state could not be cached: field 'buildTypes' from type 'com.android.build.gradle.internal.dsl.ApplicationExtensionImpl$AgpDecorated': error writing value of type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer'
                  > Configuration cache state could not be cached: field 'eventRegister' from type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer': error writing value of type 'org.gradle.api.internal.collections.DefaultCollectionEventRegister'
                     > Configuration cache state could not be cached: field 'addActions' from type 'org.gradle.api.internal.collections.DefaultCollectionEventRegister': error writing value of type 'org.gradle.internal.ImmutableActionSet$SingletonSet'
                        > Configuration cache state could not be cached: field 'singleAction' from type 'org.gradle.internal.ImmutableActionSet$SingletonSet': error writing value of type 'org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction'


0 Answers
Related