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

牟恺
2023-12-01

        在项目中我们会使用到很多的架包或者框架,一般情况下,是没有问题的。但总有一些不寻常的情况出现,如下:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> More than one file was found with OS independent path 'lib/armeabi-v7a/libnative-lib.so'

看到这种情况很明显这是一个.so文件重复调用问题,那么知道了问题解决就很简单了,去掉重复调用即可,如下:

  defaultConfig { 
        minSdkVersion 19
        targetSdkVersion 28
        
        packagingOptions {
            exclude 'lib/armeabi-v7a/libnative-lib.so'
        }
    }

        很简单的操作,我们只需要在    packagingOptions  里面添加需要去除的重复项即可,一般是直接复制错误提示地址

('lib/armeabi-v7a/libnative-lib.so')即可,可添加多条去除重复选项。

        问题即可解决。

 类似资料: