Waizau.Tam Waizau.Tam - 2 months ago 32
Android Question

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

Answer

Finally´╝îi move one of the so file to assets,and load it manually before used

 String path = getApplication().getFilesDir().toString() + "/armeabi-v7a/libgnustl_shared.so";
 if (!FileUtils.isFileExit(path))  //move so from assets to another dir
       FileUtils.initSOFileFromAssetsFile(getApplication()); 
 System.load(path);

This works not very well , although it fixes the DuplicateFileException bug . If anyone get the better way pls tell me . Thanks!^_^