android - 将 FindBugs 更新到 3.0.1 后编译 Android 项目时出错

标签 android plugins gradle android-gradle-plugin findbugs

将 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/

相关文章:

jquery - 滚动 jquery 插件

android - 使用 com.android.support :recyclerview-v7:26. 0.0-beta2 时 attr/colorError 未找到错误

gradle - 为Gradle任务属性提供派生默认值的正确方法

android - 使用 drawBitmap 缩放位图

PHP代码不返回基于过滤器的产品

java - 使用 grails 几个月后的问题

php - 在模块之间共享 Zend 助手( View 或操作)

android - 用于 ListView 的 Google Now 卡片 UI

android - Flutter android版本卡在启动画面上

java - 带有 gradle 的 groovy hadoop jar - 包不存在错误