Question

I'm getting a duplicate files error when attempting to build with Gradle.

Error:Execution failed for task ':pauwowandroid:packageDebug'.
> Duplicate files copied in APK LICENSE
    File 1: /Users/jasonrobinson/.gradle/caches/modules-2/files-2.1/org.sonatype.sisu.inject/cglib/2.2.1-v20090111/7ce5e983fd0e6c78346f4c9cbfa39d83049dda2/cglib-2.2.1-v20090111.jar
    File 2: /Users/jasonrobinson/.gradle/caches/modules-2/files-2.1/org.sonatype.sisu.inject/cglib/2.2.1-v20090111/7ce5e983fd0e6c78346f4c9cbfa39d83049dda2/cglib-2.2.1-v20090111.jar

This is different from other similar errors in that it's complaining the duplicate is in the same file. These are my exclusions:

packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/DEPENDENCIES'
}

I still get this error. It's with one particular dependency: Mockito. If I remove that dependency, the error goes away.

Was it helpful?

Solution

Try to add the following exclude:

exclude 'LICENSE.txt'

This should fix it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top