Using Android Gradle plugin 0.7.0 with the following build.gradle
:
buildscript {
repositories {
mavenCentral()
}
dependenci
This bug still exists in 0.8+/1.10
With Jackson
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.2.2'
I had to include as well as the above suggestion before it would compile
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
In my case I had to include several additional exclusions. It appears it doesn't like Regular expressions which would've made this a nice one-liner.
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
Removing .txt after LICENSE removed my error :
packagingOptions {
exclude 'META-INF/LICENSE'
}
This works for me:
android {
packagingOptions {
exclude 'LICENSE.txt'
}
}
If you want to do your part as developer, utilizing open source libraries, you should try including all those open source licenses within your apk
. To do this, you can use the merge method in your packagingOptions
.
Example:
packagingOptions {
// This will get include every license and notice regardless of what dir it’s in.
merge '**/LICENSE.txt'
merge '**/NOTICE.txt'
merge '**/notice.txt'
merge '**/license.txt'
merge '**/NOTICE'
merge '**/LICENSE'
merge '**/notice'
merge '**/license'
merge '**/LGPL2.1'
// This will exclude any README files, regardless of the dir or the file type.
exclude '**/README.*'
}
This answer is better than using pickFirst
because that method only picks the first license it finds and disregards all the rest, kinda rendering it useless in this case.
So in short, use the merge
method to include all those licenses from those kickass open source libraries you’ve been using.
More info on Gradle
PackagingOptions.