facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.88k stars 24.3k forks source link

Getting the Error while building the app using docker . Execution failed for task ':app:createBundleOnboardingappPreprodReleaseJsAndAssets'. > OS not recognized. Please set project.react.hermesCommand to the path of a working Hermes compiler. #47112

Closed khushahal closed 1 week ago

khushahal commented 1 week ago

Description

I am creating a docker image for react native android. I am trying to build the andorid apk using cmd in docker shell but getting the below error.

Task :app:createBundleOnboardingappPreprodReleaseJsAndAssets FAILED w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings 446 actionable tasks: 348 executed, 98 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/@react-native-async-storage/async-storage/android/src/javaPackage/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/react-native-bluetooth-status/android/src/main/java/com/solinor/bluetoothstatus/RNBluetoothManagerModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/@react-native-firebase/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/react-native-fk-ekart-map/android/src/main/java/com/flipkart/reactlibrary/googlemap/RNFkEkartMapLocationManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: /app/node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfView.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. /app/node_modules/react-native-screen-brightness/android/src/main/java/com/robinpowered/react/ScreenBrightness/ScreenBrightnessModule.java:257: warning: [dep-ann] deprecated item is not annotated with @Deprecated public void getBrightness(final Promise promise) { ^ /app/node_modules/react-native-screen-brightness/android/src/main/java/com/robinpowered/react/ScreenBrightness/ScreenBrightnessModule.java:270: warning: [dep-ann] deprecated item is not annotated with @Deprecated public void setBrightness(float brightness, final Promise promise) { ^ 2 warnings Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: /app/node_modules/react-native-vector-icons/android/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /app/node_modules/react-native-video/android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.


I can see the Hermes in the below path root@13e1028c607c:/app/node_modules/react-native/sdks# ls hermes-engine hermesc


Steps to reproduce

Just build command for app

React Native Version

0.72.7

Affected Platforms

Runtime - Android

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: Linux 6.6 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
  CPU: (8) arm64 unknown
  Memory: 7.49 GB / 9.70 GB
  Shell:
    version: 5.1.4
    path: /bin/bash
Binaries:
  Node:
    version: 18.20.4
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 10.7.0
    path: /usr/local/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 35.0.0
    Android NDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.7
    wanted: 0.72.7
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

> Task :app:createBundleOnboardingappPreprodReleaseJsAndAssets FAILED
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings
446 actionable tasks: 348 executed, 98 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/@react-native-async-storage/async-storage/android/src/javaPackage/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/react-native-bluetooth-status/android/src/main/java/com/solinor/bluetoothstatus/RNBluetoothManagerModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/@react-native-firebase/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/react-native-fk-ekart-map/android/src/main/java/com/flipkart/reactlibrary/googlemap/RNFkEkartMapLocationManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /app/node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/app/node_modules/react-native-screen-brightness/android/src/main/java/com/robinpowered/react/ScreenBrightness/ScreenBrightnessModule.java:257: warning: [dep-ann] deprecated item is not annotated with @Deprecated
    public void getBrightness(final Promise promise) {
                ^
/app/node_modules/react-native-screen-brightness/android/src/main/java/com/robinpowered/react/ScreenBrightness/ScreenBrightnessModule.java:270: warning: [dep-ann] deprecated item is not annotated with @Deprecated
    public void setBrightness(float brightness, final Promise promise) {
                ^
2 warnings
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /app/node_modules/react-native-vector-icons/android/src/oldarch/java/com/oblador/vectoricons/VectorIconsModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/node_modules/react-native-video/android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:createBundleOnboardingappPreprodReleaseJsAndAssets'.
> OS not recognized. Please set project.react.hermesCommand to the path of a working Hermes compiler.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 32m 3s

Reproducer

none

Screenshots and Videos

image
react-native-bot commented 1 week ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
react-native-bot commented 1 week ago
:warning: Unsupported Version of React Native
:information_source: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.
react-native-bot commented 1 week ago
:warning: Unsupported Version of React Native
:information_source: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.
react-native-bot commented 1 week ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
khushahal commented 1 week ago

@migueldaipre can you please help here

cortinico commented 1 week ago

I am creating a docker image for react native android. I am trying to build the andorid apk using cmd in docker shell but getting the below error.

The reccomendation is to use the official Docker image you can find here: https://github.com/react-native-community/docker-android

https://github.com/react-native-community/docker-android/blob/main/Dockerfile

That is linux based and will not fail with the error you're currently having.

khushahal commented 3 days ago

@cortinico : If I uses this as a base image then I got the error that this base image failed internally while creating the docker and I just directly using the docker file so getting below error while running the ./gradlew clean command.

Configure project :react-native-reanimated Android gradle plugin: 7.4.2 Gradle: 7.5 WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

FAILURE: Build failed with an exception.

khushahal commented 3 days ago

Hi @cortinico : I tried with the above docker file and facing the same issue with this as well. attaching the Error log

`

Task :app:createBundleOnboardingappProdReleaseJsAndAssets FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings 446 actionable tasks: 3 executed, 443 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

FAILURE: Build failed with an exception.

BUILD FAILED in 1m 9s error Failed to install the app. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

khushahal commented 2 days ago

@cortinico Please check and this issue still exist.

cortinico commented 2 days ago

Hi @cortinico : I tried with the above docker file and facing the same issue with this as well. attaching the Error log

The dockerfile I linked you in my previous response is in use by several CIs:

https://github.com/react-native-community/docker-android/blob/main/.github/workflows/build.yml

and the React Native CI itself:

https://github.com/facebook/react-native/blob/2861ad0c7236ef01e846c71300c4f5e09a84199d/.github/workflows/test-all.yml#L404-L408

So please provide a repository where you're building with your dockerfile and showing the error you're having so that we can investigate. Otherwise it's impossible to support you