Reputation: 7800
Let's say my project is dependent on two libraries A and B. These libraries are dependent on the same version of a library C. Library C is dependent on a couple of shared library files D. To use library C, libraries A and B both include D in their jniLibs directories.
Now, the issue here is that when I attempt to build this project with the dependencies configured:
compile('group:A:1.0@aar')
compile('group:B:1.0@aar') {
exclude group: 'group', module: 'C'
}
I receive an error stating that there are duplicate D files. How can I go about informing gradle to ignore certain jniLibs from only one of my libraries? Is there an exclude analog for jniLibs transitive dependencies?
Upvotes: 2
Views: 477
Reputation: 7800
I was able to achieve this via gradle by forcing gradle to just use the first version of the shared library that it found:
android {
packagingOptions {
pickFirst 'lib/armeabi/D.so'
pickFirst 'lib/x86_64/D.so'
pickFirst 'lib/armeabi-v7a/D.so'
pickFirst 'lib/x86/D.so'
pickFirst 'lib/arm64-v8a/D.so'
}
}
Upvotes: 2