react-nativegradleandroid-gradle-pluginupdating

Problems upgrading React Native from 0.66.5 to 0.71.0: > Task :app:createBundleReleaseJsAndAssets FAILED


I'm facing some problems doing the update of ReactNative from 0.66.5 to 0.71.0. Well, you need to solve some issues that I did little by little but now I am stuck with one related to this Gradle task, that I am not able to solve.

> 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.

I think the key is in Reason: Task ':app:lintVitalAnalyzeRelease' uses this output of task ':app:createBundleReleaseJsAndAssets' without declaring an explicit or implicit dependency but I am not being able to find the solution to it.

The fail summary:

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

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

I think it is related to Hermes, seeing the trace:

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

Solution

  • For some reason, in our structure of subprojects, we needed to have react-native and react in the root folder as dependencies installed to be able to run all phases of the build correctly.

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