运行反应本机应用程序时任务“:app:mergeDebugNativeLibs”执行失败

nou*_*one 5 gradle react-native

运行反应本机应用程序时,我收到以下错误:

`

任务:app:mergeDebugNativeLibs 失败

此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 7.0 不兼容。使用“--warning-mode all”显示各个弃用警告。请参阅https://docs.gradle.org/6.9.2/userguide/command_line_interface.html#sec:command_line_warnings 5​​74 个可操作任务:2 个已执行,572 个最新

失败:构建失败并出现异常。

  • 出了什么问题:任务“:app:mergeDebugNativeLibs”执行失败。

执行 com.android.build.gradle.internal.tasks.MergeJavaResWorkAction 时发生故障 2 个文件从输入中找到路径“lib/armeabi-v7a/libfbjni.so”: - C:\Users\nouman.gradle\caches\transforms -3\6ef14503de3c85fa1ab2aba364d580cc\transformed\jetified-react-native-0.71.0-rc.0-debug\jni - C:\Users\nouman.gradle\caches\transforms-3\64faf76bb2f0142d731347d7bfff47d4\transformed\jetified-fbjni-0 .3. 0\jni 如果您使用 jniLibs 和 CMake IMPORTED 目标,请参阅 https://developer.android.com/r/tools/jniLibs-vs-imported-targets

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • 在https://help.gradle.org获取更多帮助

32 秒内构建失败

错误 无法安装应用程序。确保您已设置 Android 开发环境:https://reactnative.dev/docs/environment-setup。错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

失败:构建失败并出现异常。

  • 出了什么问题:任务“:app:mergeDebugNativeLibs”执行失败。

执行 com.android.build.gradle.internal.tasks.MergeJavaResWorkAction 时发生故障 2 个文件从输入中找到路径“lib/armeabi-v7a/libfbjni.so”: - C:\Users\nouman.gradle\caches\transforms -3\6ef14503de3c85fa1ab2aba364d580cc\transformed\jetified-react-native-0.71.0-rc.0-debug\jni - C:\Users\nouman.gradle\caches\transforms-3\64faf76bb2f0142d731347d7bfff47d4\transformed\jetified-fbjni-0 .3. 0\jni 如果您使用 jniLibs 和 CMake IMPORTED 目标,请参阅 https://developer.android.com/r/tools/jniLibs-vs-imported-targets

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • 在https://help.gradle.org获取更多帮助

32 秒内构建失败

at makeError (D:\BayQi-Customer-Mobile-App\node_modules\execa\index.js:174:9)
at D:\BayQi-Customer-Mobile-App\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\BayQi-Customer-Mobile-App\node_modules\react-native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (D:\BayQi-Customer-Mobile-App\node_modules\@react-native-community\cli\build\index.js:192:9)
Run Code Online (Sandbox Code Playgroud)

info 使用 --verbose 标志运行 CLI 以获取更多详细信息。`

我正在尝试在物理设备中运行我的反应本机应用程序,但收到此错误。本来运行正常,但是突然就停止了

Kis*_*ela 10

更新的答案

\n

>= 0.63 的补丁我们已经为所有主要版本的 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

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

\n

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

\n

旧答案

\n

将其添加到您的android/build.gradle

\n
def REACT_NATIVE_VERSION = new File([\'node\', \'--print\',"JSON.parse(require(\'fs\').readFileSync(require.resolve(\'react-native/package.json\'), \'utf-8\')).version"].execute(null, rootDir).text.trim())\n\nallprojects {\n    configurations.all {\n        resolutionStrategy {\n            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION\n        }\n    }\n
Run Code Online (Sandbox Code Playgroud)\n

如果这对您不起作用(使用动态版本),则将您的版本硬编码为:

\n

更新 REACT-NATIVE 时请小心移动此版本

\n
allprojects {\n    configurations.all {\n        resolutionStrategy {\n            force \'com.facebook.react:react-native:<your version>\'\n        }\n    }\n    repositories {\n    // ...\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

检查更多更新https://github.com/facebook/react-native/issues/35204

\n


小智 5

将其添加到您的 app/build.gradle

android {
   // yout existing code
   packagingOptions {
        pickFirst '**/libc++_shared.so'
        pickFirst '**/libfbjni.so'
    }
}
Run Code Online (Sandbox Code Playgroud)