I'm including 2 Apache licensed libraries into my Android app, when I attempt to generate the application I'm having the infamous "Duplicate files during packaging" error.
My first attempt to solve was, as suggested in a lot of places (e.g.), to exclude the files, it worked and my apk was generated.
Then I realized that since 0.9.1. Gradle includes pickFirst
option to place into the apk the first license found during compilation time.
packagingOptions {
pickFirst 'META-INF/LICENSE.txt'
pickFirst 'META-INF/NOTICE.txt'
}
Problem is, Notice.txt contains only information about one of the licensed libraries, not both. For example, notice.txt of Apache Commons Codec is:
Apache Commons Codec Copyright 2002-2011 The Apache Software Foundation
This product includes software developed by The Apache Software Foundation (http://www.apache.org/).
-------------------------------------------------------------------------------- src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java contains test data from http://aspell.sourceforge.net/test/batch0.tab.
Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org). Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
and Joda Time's:
============================================================================= = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = ============================================================================= This product includes software developed by Joda.org (http://www.joda.org/).
My question is, is there a way to "merge" the license
and notice
files automatically? I assume this is a common problem so I guess I'm not the first one facing it.