Reputation: 515
I try to build project but this error occured:
Error:Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/x86/libjniopenblas.so
File1: C:\Users\1\.gradle\caches\modules-2\files-2.1\org.bytedeco.javacpp-presets\openblas\0.2.19-1.3\2189141b6c83cc8e5b342b04e8f49e22996f72f4\openblas-0.2.19-1.3-android-x86.jar
File2: D:\Smart House\Sip projects\Camera\tipit\build\intermediates\bundles\default\jni
How to exclude this directory from build D:\Smart House\Sip projects\Camera\tipit\build\intermediates\bundles\default\jni
?
Upvotes: 1
Views: 1601
Reputation: 29783
You can use pickFirst in packagingOptions
to use only one of libjniopenblas.so
file:
You need to get the correct package name of libjniopenblas.so
from File1 or File2:
android {
...
packagingOptions {
// This is using the library in File1
pickFirst 'org.bytedeco.javacpp-presets/openblas/lib/x86/libjniopenblas.so'
...
}
...
}
But instead of the above, you can using exclude. First, find the dependency which using the libjniopenblas.so
by checking it from the dependency tree with:
./gradlew app:dependencies
Then after you found it, exclude it from the library with:
compile('com.library.name:version') {
exclude "libjniopenblas.so"
// or exclude the module of the library
}
Upvotes: 2