对输入中找到的路径“lib/arm64-v8a/libfbjni.so”的本机 2 文件做出反应

Ste*_*eve 32 android build.gradle 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
Run Code Online (Sandbox Code Playgroud)

在 Mac 中,出现以下错误 -

* 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
Run Code Online (Sandbox Code Playgroud)

Ste*_*eve 64

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

\n
allprojects {\nrepositories {\n   exclusiveContent {\n       // We get React Native\'s Android binaries exclusively through npm,\n       // from a local Maven repo inside node_modules/react-native/.\n       // (The use of exclusiveContent prevents looking elsewhere like Maven Central\n       // and potentially getting a wrong version.)\n       filter {\n           includeGroup "com.facebook.react"\n       }\n       forRepository {\n           maven {\n               url "$rootDir/../node_modules/react-native/android"\n           }\n       }\n    }\n    // ...\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

此修复将应用一个exclusiveContent解析规则,强制解析 React Native Android 库,以使用node_modules.

\n

将应用程序更新为 React Native 后v0.71.0,将不再需要此修复程序。\n原因 - 此处非常简要地解释了原因 -修复和更新 Android 构建失败

\n

更新 - 由于同样的原因,这也修复了 kotlin 的问题

\n
Incompatible classes were found in dependencies.\nModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.0.\n
Run Code Online (Sandbox Code Playgroud)\n

更新 - React Native 团队已为所有主要版本的 React-Native 推送了修补程序版本,如下所示:

\n

0.70.5: https: //github.com/facebook/react-native/releases/tag/v0.70.5

\n

\xef\xb8\x8f 0.69.7:https://github.com/facebook/react-native/releases/tag/v0.69.7

\n

0.68.5: https: //github.com/facebook/react-native/releases/tag/v0.68.5

\n

\xef\xb8\x8f 0.67.5:https://github.com/facebook/react-native/releases/tag/v0.67.5

\n

\xef\xb8\x8f 0.66.5:https://github.com/facebook/react-native/releases/tag/v0.66.5

\n

\xef\xb8\x8f 0.65.3:https://github.com/facebook/react-native/releases/tag/v0.65.3

\n

\xef\xb8\x8f 0.64.4:https://github.com/facebook/react-native/releases/tag/v0.64.4

\n

\xef\xb8\x8f 0.63.5:https://github.com/facebook/react-native/releases/tag/v0.63.5

\n

通过更新到您的 中的这些补丁版本package.json,您的 Android 版本应该可以重新开始工作。

\n