美文网首页
Gradle Zip:no duplicate handling

Gradle Zip:no duplicate handling

作者: SEVENOnduty | 来源:发表于2023-02-15 15:47 被阅读0次

在build.gradle(:app)里面,想在配置完后执行一个压缩任务:

以上代码表示,apk在编译配置即将结束的时候,会将task zip任务, 注入在gradle的执行流程里,当单独运行task zip任务的时候,因为它在apk编译执行流程里面,所以它就会启动apk的编译,随后执行task zip任务

但是 当运行上面的task zip任务时,报了以下错误:

Execution failed for task ':app:zip'.

> Entry output-metadata.json is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.6/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

这里的意思就是gradle需要一个对重复文件的处理策略,所以给任务里面加个策略就行:

duplicatesStrategy 'exclude'  或者是 'include'

相关文章

网友评论

      本文标题:Gradle Zip:no duplicate handling

      本文链接:https://www.haomeiwen.com/subject/ququkdtx.html