* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake
In app/build.gradle file
packagingOptions {
pickFirst 'lib/x86/libc _shared.so'
pickFirst 'lib/x86_64/libc _shared.so'
pickFirst 'lib/arm64-v8a/libc _shared.so'
pickFirst 'lib/armeabi-v7a/libc _shared.so'
} still giving error....
Tried
In app/build.gradle file
packagingOptions {
pickFirst 'lib/x86/libfbjni.so'
pickFirst 'lib/x86_64/libfbjni.so'
pickFirst 'lib/arm64-v8a/libfbjni.so'
pickFirst 'lib/armeabi-v7a/libfbjni.so'
}
but it giving following error More than one file was found with OS independent path 'lib/armeabi-v7a/libc _shared.so'.
CodePudding user response:
I past like 5 hours with this issue and here is the solution https://github.com/facebook/react-native/issues/35210
CodePudding user response:
The fix for current react-native
We're suggesting all users of React Native to apply this fix to your top level build.gradle file as follows:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// ...
}
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
// NOTE: if you are in a monorepo, you may have "$rootDir/../../../node_modules/react-native/android"
url "$rootDir/../node_modules/react-native/android"
}
}
}
// ...
}
}
What this fix will do is apply an exclusiveContent resolution rule that will force the resolution of React Native Android library, to use the one inside node_modules.
Once you update your app to React Native v0.71.0, this fix won't be needed anymore.