gradle 将React Native从0.66.5升级到0.71.0时出现问题:>任务:应用程序:创建捆绑发布JsAndAssets失败

pnwntuvh  于 2023-01-31  发布在  React
关注(0)|答案(1)|浏览(242)

我在更新ReactNative from 0.66.5 to 0.71.0时遇到了一些问题。您需要解决一些问题,这些问题是我一点一点解决的,但现在我遇到了一个与此Gradle任务相关的问题,我无法解决。
> Task :app:createBundleReleaseJsAndAssets FAILED

Execution optimizations have been disabled for task ':app:createBundleReleaseJsAndAssets' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '<whatever>/app/build/generated/res/react/release'. Reason: Task ':app:lintVitalAnalyzeRelease' uses this output of task ':app:createBundleReleaseJsAndAssets' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.

我认为关键在于Reason: Task ':app:lintVitalAnalyzeRelease' uses this output of task ':app:createBundleReleaseJsAndAssets' without declaring an explicit or implicit dependency,但我无法找到它的解决方案。
失败总结:

* What went wrong:
Execution failed for task ':app:createBundleReleaseJsAndAssets'.

> Process 'command 'node'' finished with non-zero exit value 1

我认为这与爱马仕有关,看到痕迹:

at com.facebook.react.tasks.BundleHermesCTask.runCommand(BundleHermesCTask.kt:129)
        at com.facebook.react.tasks.BundleHermesCTask.run(BundleHermesCTask.kt:89)
yquaqz18

yquaqz181#

出于某种原因,在我们的子项目结构中,我们需要将react-nativereact作为依赖项安装在根文件夹中,以便能够正确运行构建的所有阶段。

...
  "dependencies": {
    "react": "18.2.0",
    "react-native": "0.71.1"
  }
  ...

相关问题