欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

More than one file was found with OS independent path ‘lib/armeabi-v7a/xxxx.so

程序员文章站 2024-03-25 08:31:16
...

出现的问题:

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

问题原因:

看网上说是同样的依赖路径存在两个,就是导入了两次同名的依赖

解决方法:

在app的build.gradle中添加以下代码即可解决问题

sourceSets {
        main {
            jniLibs.srcDirs = ['jniLibs']
        }
    }

注意:有两个build.gradle,我们是在app的build.gradle中的android节点下配置,而截图中右边的build.gradle是整个项目的。

More than one file was found with OS independent path ‘lib/armeabi-v7a/xxxx.so

 踩坑注意:

如果在sourceSets.main中配置了jnilibs.srcDirs后,就不要在android节点下添加以下配置

我的出现了错误 library "libopencv_java3.so" not found)

packagingOptions {
        exclude 'lib/armeabi-v7a/libt_demo.so'
    }

在搜索More than one file was found with OS independent path ‘lib/armeabi-v7a/xxxx.so这个问题的时候网上还有一种解决方法,

More than one file was found with OS independent path ‘lib/armeabi-v7a/xxxx.so

把这个配置删除掉或者将exclude换成pickFirst+错误路径就可以解决新出现的错误 library "libopencv_java3.so" not found(我是直接注释掉了)

每个人遇到的错误情况不一样,但是大致就这几种方法,可以都去尝试一下,希望能够对大家有帮助。