Question

I'm getting this error (AGAIN!) on android. Recently updated to the latest version of gradle 0.7.3 and also to the latest version of espresso framework (1.1) and I'm back to the infamous "duplicate file" bug.

Execution failed for task ':mobile:packageTesttype'.

Duplicate files copied in APK META-INF/LICENSE.txt File 1: /Users/mwolfe/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.2.4/dba4d4d224e2ca872af5be8d2992777583145478/httpmime-4.2.4.jar File 2: /Users/mwolfe/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.2.4/dba4d4d224e2ca872af5be8d2992777583145478/httpmime-4.2.4.jar

I already have set my build.gradle file to exclude these files. The app assembles fine for debug/release and runs fine, However building/running for test it fails. Specifically when I try to run instrument tests with the followng command is when I get the error mentioned above.

gradle connectedCheck

I have a library project as well and have tried every which way to add the exclusions to both build files. This specific dependency is from the library project. Both of them have the following exclusions

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

I've also tried with removing the META-INF part above as it shows in the espresso docs here: https://code.google.com/p/android-test-kit/wiki/Espresso#Espresso_Setup_Instructions

I know I can delete these files from the jars but it's quite a pain.

Was it helpful?

Solution

Try to include other variations too...Copy and paste this:

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

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