Home > OS >  react native 2 files found with path 'lib/arm64-v8a/libfbjni.so' from inputs
react native 2 files found with path 'lib/arm64-v8a/libfbjni.so' from inputs

Time:11-07

I am getting this error since yesterday while running react native app and absolutely no changes were made which is crazy. I have wasted so many hours so decided to ask here. Already tried gradle clean and also deleting .gradle and build folders. Please check the error below -

Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
> 2 files found with path 'lib/arm64-v8a/libfbjni.so' from inputs:
  - C:\Users\DELL\.gradle\caches\transforms-3\fec30cdec6405e4005c100e8efa899d0\transformed\jetified-react-native-0.71.0-rc.0-debug\jni\arm64-v8a\libfbjni.so
  - C:\Users\DELL\.gradle\caches\transforms-3\09bb94ee0a520d6ded1278936c1d07c7\transformed\jetified-fbjni-0.3.0\jni\arm64-v8a\libfbjni.so
 If you are using jniLibs and CMake IMPORTED targets, see
 https://developer.android.com/r/tools/jniLibs-vs-imported-targets

CodePudding user response:

To fix this issue, you need to add the following in your android/build.gradle file.

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 {
               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. Reason - The reason is very briefly explained here - Fix and updates on Android build failures

CodePudding user response:

Here is a little context about why is happening this:

https://github.com/facebook/react-native/issues/35210

Here there is the best approach to fix this:

https://github.com/facebook/react-native/issues/35210#issuecomment-1304536693

I hope it helps.

  • Related