The two files LICENCE and NOTICE file where added in the jar file of the v.2.2.0 release. Unfortunately, Android has a limitation that duplicate files cannot exists while packaging the app. Since jackson-core already has these files, the packaging fails.
One workaround is to rename the files or move them to another folder.
[Updated] Just for those searching the same problem on Google, the Eclipse error message is "Error generating final archive: Found duplicate file for APK"
Thank you for reporting this problem!
This is very unfortunate limitation wrt Android... since (AFAIK) convention is to leave these at root level of jars.
I'll see how to resolve this; need to discuss it on dev list.
One question: since pretty much all Apache Licensed jars should have these same files, how do those work?
One workaround/solution that might be relevant is this:
which seems to just allow duplicates.
and from another similar question, looks like one would do:
Finally I found it! There is indeed one option, which does what I need in the maven-android-plugin.
The "extractDuplicates" workaround works for Maven, but not with the Eclipse builder. :(
I have around 15 other JARs. Most do not include license. For example "commons-io", "commons-lang", "commons-collection", "guice", "guava", "android-support" and "jsr305". Each of these JAR files does not include a licence.
I have checked and the commons-* libraries are distributed in zip files that contains the license and the JAR file.
I have another one (joda-time - a popular date/time library) that have LICENCE.txt and NOTICE.txt under \META-INF.
Sad thing is that addition of LICENSE was due to a user request; big Open Source companies / projects (like Debian I think) are big on having this information included.
I'll see what can be done here to satisfy conflicting requirements.
Ok. Looking at multiple jars by ASF projects (Avro, Ant, commons-compress), looks like they actually include LICENSE and NOTICE files under META-INF. Maybe tools know that these files can collide freely?
I could make this change easily, and assume it to be sort of best practice anyway.
Would it be possible for you to test this locally, to verify whether this would resolve the issue?
This (using per-package location) could work, as long as we can figure out how to make Maven build do that.
But first I would like to see if APK tools at least had sensible logic wrt META-INF -- it is possible (but not guaranteed) that entries in there would not conflict.
I added commons-compress to my project and it builds successfully. Even though the joda-time library also have the same file.
So I did some investigation and moved the LICENSE and NOTICE file under \META-INF for both jackson-core and jackson-databind and the build works now. It appears that the duplicate file problem can be fixed if those file are moved under \META-INF.
It make sense since anything else not under \META-INF is treated like code or asset of this code and Android packages it into the app.... err... package. Hence the duplicate file problem! :)
I think for now we can just move these under META-INF directly, since that seems to be "the Apache way".
So unless there's other reason to do that, let's postpone fancier tricks.
@thierryd thank you for checking this out -- I'll fix the issue next.
Fix #214, problems with Android packaging, LICENSE/NOTICE files
Fixed core jars that had these files added; should work better for 2.2.1.
Hi, when will version 2.2.1 be available? I'm currently facing the same issues with the duplicate file error on Android.
It is a careful balancing act -- since releasing new set of patch versions is significant amount of work, I would hope to find out all critical 2.2.0 issues. But at the same time, already fixed critical things should go out ASAP.
At practical level I may have to do it over this weekend -- I will be travelling next week, and couldn't do release.
So either this or next weekend, I think.
Okay cool, it would be great if you could do it this weekend. Until then I will have to use 2.1.4
Thanks for this awesome library!
Understood -- feels silly, given that 2.2 otherwise should be nice upgrade esp. on Android.
Fix conflicts with Android's APK build
It doesn't handle duplicates correctly. Problem description and fix adapted from