【问题标题】:react native 2 files found with path 'lib/arm64-v8a/libfbjni.so' from inputs反应从输入中找到路径 \'lib/arm64-v8a/libfbjni.so\' 的本机 2 文件
【发布时间】:2022-11-06 14:41:36
【问题描述】:

从昨天开始,我在运行 react native 应用程序时收到此错误,并且绝对没有进行任何更改,这太疯狂了。我浪费了这么多时间,所以决定在这里问。已经尝试过 gradle clean 并删除 .gradle 和 build 文件夹。请检查以下错误 -

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

【问题讨论】:

    标签: android react-native build.gradle


    【解决方案1】:

    要解决此问题,您需要在 android/build.gradle 文件中添加以下内容。

    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"
               }
           }
        }
        // ...
      }
    }
    

    此修复将应用 exclusiveContent 解析规则,该规则将强制 React Native Android 库的解析,以使用 node_modules 中的那个。

    一旦你将你的应用更新到 React Native v0.71.0,就不再需要这个修复了。 原因 - 原因在这里非常简单地解释 - Fix and updates on Android build failures

    【讨论】:

      猜你喜欢
      • 2022-11-08
      • 1970-01-01
      • 2022-01-15
      • 2023-01-17
      • 2022-06-24
      • 2022-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多