如何修复在第三方SDK中重复的libgnustl_shared.so文件? [英] How to fix the libgnustl_shared.so file duplicated which in third party sdks?

查看:1182
本文介绍了如何修复在第三方SDK中重复的libgnustl_shared.so文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用gradle构建并运行apk时,出现以下错误::::

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

推荐答案

最后,我将一个so文件移至资产,并在使用前手动加载

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);

尽管修复了DuplicateFileException错误,但效果不是很好. 如果有人得到更好的方法,请告诉我. 谢谢!^ _ ^

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

这篇关于如何修复在第三方SDK中重复的libgnustl_shared.so文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆