More than one file was found with OS independent path


发现多个依赖文件

More than one file was found with OS independent path 'lib/armeabi-v7a/libst


Caused by: com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'lib/armeabi-v7a/libstlport_shared.so'

More than one file was found with OS independent path 'lib/x86/libstlport_shared.so'


原因:
依赖有多个名称不同,但是功能相同的library,我就依赖了两个视屏播放的框架,一个百度的,一个vitamio
两个框架下都使用相同的.so文件.
在项目根目录下搜一下就可以发现多个如libstlport_shared.so'的同名文件


解决方法:
在android{}中加入如下代码,后面对应的文件要改成自己的

android {
    
    packagingOptions {//加上这些代码
        pickFirst 'lib/armeabi-v7a/libstlport_shared.so'
        pickFirst 'lib/armeabi-v8a/libstlport_shared.so'
        pickFirst 'lib/arm64-v8a/libstlport_shared.so'
        pickFirst 'lib/x86/libstlport_shared.so'
        pickFirst 'lib/x86_64/libstlport_shared.so'
    }

}

你可能感兴趣的:(More than one file was found with OS independent path)