After installing a plugin, I'm getting the following error:
Execution failed for task ':transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/DEPENDENCIES
File1: C:\Users\Vinicius\Desktop\webapps\paypadapp\platforms\android\libs\httpcore-4.3.2.jar
File2: C:\Users\Vinicius\Desktop\webapps\paypadapp\platforms\android\libs\httpclient-4.3.3.jar
File3: C:\Users\Vinicius\Desktop\webapps\paypadapp\platforms\android\libs\httpmime-4.3.3.jar
When doing a search, I found the following solution
Add this in android manifest:
packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
exclude 'META-INF/LICENSE' // will not include LICENSE file
// as noted by #Vishnuvathsan you may also need to include
// variations on the file name. It depends on your dependencies.
// Some other common variations on notice and license file names
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
But where do I add that in ionic / cordova?
I created an ionic project from scratch and installed the plugin, the same error occurs
Related
My code builds fine, but when I try to run it in debug, I get the following error:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/BCKEY.DSA
File1: D:\Android\AndroidStudio\gradle\m2repository\org\bouncycastle\bcpkix-jdk15on\1.48\bcpkix-jdk15on-1.48.jar
File2: C:\Users\beili\.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.48\960dea7c9181ba0b17e8bab0c06a43f0a5f04e65\bcprov-jdk15on-1.48.jar
How can I resolve this?
Add this to your build.gradle inside the android section like
android{
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/BCKEY.DSA'
exclude 'AUTHORS'
}
}
I've been looking around at some of the answers posted here about this error but have had no luck. I'm hoping to get some clarification about what's going on. my error is as follows:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/commons-io/commons-io/pom.xml
File1: /home/colin/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-io/1.3.2/b6dde38349ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar
File2: /home/colin/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/1.3.2/b6dde38349ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar
I've done
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
in the app > build.gradle file, but the problem persists. Is there somewhere else I should put this, or perhaps just delete some file? Or perhaps I've excluded too many files - Should I omit some of these lines, and if so which ones? I also tried moving the dependencies in to the top, above Android to no avail.
Furthermore I'm a little confused about some of the advice given in these posts. What is the operating difference between Exclude and PickFirst? They seem to be interchangeable but express very different ideas. It seems I'm required to include a license when uploading to the app store, so if I'm excluding it here in order to get the app to compile, where do I include it later on when I'm ready to upload? I hope someone can shed some more light on what's going on here.
I had to add the following lines to packagingOptions {}
exclude 'META-INF/maven/commons-io/commons-io/pom.xml'
exclude 'META-INF/maven/commons-io/commons-io/pom.properties'
My problem was pretty foolish; when including exclude 'META-INF/maven/commons-io/commons-io/pom.xml' I got an error that looked very similar to the first one, but was in fact different. adding exclude 'META-INF/maven/commons-io/commons-io/pom.properties' finally got everything working. Still not sure why exactly I have to take these steps though.
I added the latest Joda Time jar into my libs folder and added the library. when trying to run I get the following error:
Error:Execution failed for task ':Selfies:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
File 1: C:\Users\Dominic\Desktop\selfieapp\Selfies\Selfies\libs\commons-io-2.4.jar
File 2: C:\Users\Dominic\Desktop\selfieapp\Selfies\Selfies\libs\joda-time-2.8.1.jar
Not too sure what this means and how to fix it. Any help would be great!
Update yout build.gradle like this:
android {
...
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
you can exclude this file with packagingOptions in your build.gradle - but you should also have a look into joda-time-android or even better https://github.com/JakeWharton/ThreeTenABP
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.
Try to add the following exclude:
exclude 'LICENSE.txt'
This should fix it.
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.
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'
}