将 Findbugs 插件更新到 3.0.1 版本后,我无法在 Android Studio 中编译多模块项目。我还使用 "com.google.code.findbugs:annotations:3.0.1"
依赖项来使用 FindBugs 注释(例如 @SuppressFBWarnings
)。
我在组装项目时遇到以下错误:
Execution failed for task ':presentation:packageAllDevelopDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: javax/annotation/CheckForNull.class
我该如何解决?
最佳答案
我解决了这个问题,原因是添加到 "com.google.code.findbugs:annotations:3.0.1"
附加依赖项('com.google.code.findbugs :jsr305:3.0.1'
和 'net.jcip:jcip-annotations:1.0'
)。要修复它,我们需要排除一些传递依赖项。
替换:
dependencies {
compile "com.google.code.findbugs:annotations:3.0.1"
}
与
dependencies {
compile ("com.google.code.findbugs:annotations:3.0.1") {
exclude module: 'jsr305'
exclude module: 'jcip-annotations'
}
}
或与
dependencies {
compile ("com.google.code.findbugs:annotations:3.0.1") {
transitive = false
}
}
关于android - 将 FindBugs 更新到 3.0.1 后编译 Android 项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33262470/