一、前言:
1、Android报错:More than one file was found with OS independent path 'lib/arm64-v8a/librtmp-jni.so。
造成的原因:
库被导入了至少两次,系统不知道该选取哪个使用。
解决办法:
在app/build.gradle中加入如下代码,去掉重复的库。
android {
packagingOptions {
//注意:对应上重复so的名字
exclude 'lib/arm64-v8a/librtmp-jni.so'
}
}
exclude 后面添加要去除的重复的库,可以添加多个。
然后点击 sync Now,问题解决。
2、去重重复第一个,又来一个类似的错误,继续去除
//又出现一个
More than one file was found with OS independent path lib/x86_64/librtmp-jni.so'
//又出现一个
More than one file was found with OS independent path lib/x86/librtmp-jni.so'
//又出现一个
More than one file was found with OS independent path 'lib/armeabi-v7a/librtmp-jni.so'
出现重复的全部去除
android {
packagingOptions {
//注意:对应上重复so的名字
exclude 'META-INF/core.kotlin_module'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/INDEX.LIST'
exclude 'lib/arm64-v8a/librtmp-jni.so'
exclude 'lib/x86_64/librtmp-jni.so'
exclude 'lib/x86/librtmp-jni.so'
exclude 'lib/armeabi-v7a/librtmp-jni.so'
}
}
然后全部去除之后,sync Now,问题解决了。
网友评论