Definitive solution for "Duplicate files copied in APK"

I have two very similar jar in the dependencies and useless to say, I need them both and they are huge.

I already tried to wrote a dozen of pickFirst

packagingOptions {
        pickFirst '...'

But obviously it’s a crap solution.

What I’d need is to say to Gradle to always pick the first one.

Is that possible or is that another solution to my problem?


Intellij 2017.1 EAP CE

Gradle wrapper 3.3

Android API 25