Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error compiling Android project after updating FindBugs to 3.0.1

After updating Findbugs plugin up to 3.0.1 version I can't compile multi module project in Android Studio. Also i use "com.google.code.findbugs:annotations:3.0.1" dependency for using FindBugs annotations (e.g. @SuppressFBWarnings).

I get following error while assembling project:

Execution failed for task ':presentation:packageAllDevelopDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: javax/annotation/CheckForNull.class

How can I fix it?

like image 883
ultraon Avatar asked Oct 21 '15 14:10

ultraon


1 Answers

I resolved this issue, the cause was in adding to "com.google.code.findbugs:annotations:3.0.1" additional dependencies ('com.google.code.findbugs:jsr305:3.0.1' and 'net.jcip:jcip-annotations:1.0'). To fix it we need to exclude some transitive dependencies.

Replace:

dependencies {
    compile "com.google.code.findbugs:annotations:3.0.1"
}

with

dependencies {
    compile ("com.google.code.findbugs:annotations:3.0.1") {
      exclude module: 'jsr305'
      exclude module: 'jcip-annotations'
    }
}

or with

dependencies {
    compile ("com.google.code.findbugs:annotations:3.0.1") {
        transitive = false
    }
}
like image 163
ultraon Avatar answered Nov 14 '22 23:11

ultraon