There is a solution if you have only one license using the name license.txt
(read: all license.txt
copies are identical):
packagingOptions {
pickFirst 'META-INF/license.txt'
}
Otherwise, Google also released a Gradle plugin to manage dependencies licenses. See here. I didn’t try it, but it looks like it’s capable of aggregating every dependency, and even generating an activity displaying all of those licenses.