Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Duplicate LICENCE & NOTICE files in v2.2.0 make Android packaging step fails #214

Closed
thierryd opened this Issue · 16 comments

5 participants

thierryd Tatu Saloranta Bob Kerns Paul Brown Frieder Bluemle
thierryd

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"

Tatu Saloranta

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.

Tatu Saloranta

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:

http://stackoverflow.com/questions/8103863/duplicate-file-when-deploying-apk

which seems to just allow duplicates.

Tatu Saloranta

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.
  <extractDuplicates>true</extractDuplicates>

(from https://groups.google.com/forum/?fromgroups=#!topic/maven-android-developers/QjbzoaC1Q3k)

thierryd

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.

Thanks! :)

Tatu Saloranta

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.

Bob Kerns
Tatu Saloranta

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?

Tatu Saloranta

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.

Tatu Saloranta cowtowncoder was assigned
thierryd

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! :)

Paul Brown
Owner
Tatu Saloranta

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.

Tatu Saloranta

Fixed core jars that had these files added; should work better for 2.2.1.

Frieder Bluemle

Hi, when will version 2.2.1 be available? I'm currently facing the same issues with the duplicate file error on Android.
Thanks.

Tatu Saloranta
Owner

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.

Frieder Bluemle

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!

Tatu Saloranta
Owner

Understood -- feels silly, given that 2.2 otherwise should be nice upgrade esp. on Android.

Thanks!

Francis Galiegue fge referenced this issue from a commit in fge/jackson-coreutils
Francis Galiegue fge Fix conflicts with Android's APK build
It doesn't handle duplicates correctly. Problem description and fix adapted from
FasterXML/jackson-databind#214.
046c100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.