包装过程中的Android,摇篮和重复文件错误 [英] Android, Gradle and duplicate files error during packaging
问题描述
我要使用JSON-架构验证器在我的Android项目是这样的:
I want to use the json-schema-validator in my Android project like this:
{相关性
编译com.github.fge:JSON-架构验证:2.1.8
}
不幸的摇篮停止包装,由于该文件中的重复错误:
Unfortunately Gradle stops packaging due to this file duplicate error:
归档路径:draftv3 /模式
原产地1: /Users/andrej/.gradle/caches/modules-2/files-2.1/com.github.fge/json-schema-validator/2.1.8/4c2a5be8ce86c2338561a651d7d22fb4c4a8763d/json-schema-validator-2.1.8.jar
原产地2: /Users/andrej/.gradle/caches/modules-2/files-2.1/com.github.fge/json-schema-core/1.1.9/4ead9ba3fb3bde69d93f738042d12a9e60e41645/json-schema-core-1.1.9.jar$c$c>
我知道我可以忽略这样的文件:
I know I can ignore the file like this:
packagingOptions {
排除draftv3 /模式
}
不过,该文件是由JSON-架构验证和JSON-验证核心使用,所以它在产生的APK必需的。
But the file is used by json-schema-validator and json-validator-core, so it is required in the resulting APK.
我怎么能强迫摇篮进行包装,同时保持该文件的两个版本中的一个(他们是平等的)?
How can I force Gradle to proceed packaging while keeping one of the two versions of this file (they are equal)?
谢谢,
安德烈
Thanks, Andrej
推荐答案
对于其他人,这里一个快速的解决办法,直到摇篮将增加包装选择适当的重复策略:
For others, here a quick workaround until Gradle will add packaging options with proper duplicate strategies:
android.applicationVariants.all {variant->
variant.assemble.doFirst {
EXEC {
可执行的SH
ARGS-c,查找〜/ .gradle /缓存/ -iname'JSON-架构验证的* .jar-exec拉链-d'{}''draftv3 /模式'\\\\;
ARGS-c,查找〜/ .gradle /缓存/ -iname'JSON-架构验证的* .jar-exec拉链-d'{}''draftv4 /模式'\\\\;
}
}
}
这篇关于包装过程中的Android,摇篮和重复文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!