当gradle缓存遇到华为插件

今天是上坟(班)第一天,刚拿到一个项目,正好看到这个gradle优化文章【Gradle-14】编译优化之Gradle最佳配置实践[https://juejin.cn/post/7344625554529730600]。哎,我就喜欢这种不用写代码的技术,

org.gradle.unsafe.configuration-cache=true //配置缓存

这个不错,立马加上。加好了项目也编译好了,一跑就完犊子。错误如下:

Configuration cache state could not be cached: field 'configFile' from type 'com.huawei.agconnect.agcp.AGCPluginTask': error writing value of type 'com.huawei.agconnect.agcp.ConfigFile'
> Configuration cache state could not be cached: field 'variant' from type 'com.huawei.agconnect.agcp.ConfigFile': 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 'artifacts' from type 'com.android.build.gradle.internal.variant.TestVariantData': 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 'directory' 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)

一眼盯真,这肯定是华为的错,然后开启华为论坛之旅,无果。查找良久,后来鼠标滑到了上边

- Task `:app:processDebugAGCPlugin` of type `com.huawei.agconnect.agcp.AGCPluginTask`: cannot serialize object of type 'com.android.build.gradle.internal.tasks.DexMergingTask', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.

翻译如下:
com.huawei.agconnect.agcp.AGCPluginTask”类型的任务“:app:processDebugAGCPlugin”:无法序列化“com.android.build.gradle.internal.tasks.DexMergingTask”类型的对象(“org.gradle”的子类型) .api.Task',因为配置缓存不支持这些。
忽然就想到上面加的配置缓存。删掉,app run success ~~~
好了,问题解决,又是划水的一天。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容