Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android gradle duplicate LICENSE.txt file again

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.

like image 363
Matt Wolfe Avatar asked Mar 21 '23 01:03

Matt Wolfe


1 Answers

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'

}
like image 111
Tim Boland Avatar answered Apr 01 '23 10:04

Tim Boland