Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the libgnustl_shared.so file duplicated which in third party sdks?

When i used the gradle to build and run the apk, i get the error below::::

Error:Execution failed for task ':app:transformNative_libsWithMergeJniLibsForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi-v7a/libgnustl_shared.so
    File1:  
app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jni
    File2:  
app/build/intermediates/exploded-aar/app/videosdk/unspecified/jni
like image 477
Waizau.Tam Avatar asked May 13 '16 03:05

Waizau.Tam


1 Answers

Cleaner solution is to explicitly tell Gradle that you know about the problem and accept any of these files. Depending on the architectures you support you may need only some of the. You can find details in documentation

android {

 // some stuff
 packagingOptions {
        pickFirst 'lib/armeabi-v7a/libgnustl_shared.so'
        pickFirst 'lib/arm64-v8a/libgnustl_shared.so'
        pickFirst 'lib/x86_64/libgnustl_shared.so'
        pickFirst 'lib/x86/libgnustl_shared.so'
    }
}
like image 50
Gaket Avatar answered Sep 27 '22 22:09

Gaket