facebook / react-native

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

building android build for the react native tester app is failing #44442

Closed Biki-das closed 2 days ago

Biki-das commented 1 week ago

Description

for couple of days, i am unable to build the react native tester app, for the android, though the iOS is building successfully without any issues, the android build is failing and i am kinda unable to figure out, though my local environment is set up correctly as i am able to run a react native scaffolding without any issue and build the android counterpart.

here are error logs while trying to build the rn tester app

Screenshot 2024-05-07 at 6 43 00 PM

Steps to reproduce

  1. cd react-native , the main react native repository
  2. try yarn android
  3. build probably would fail

React Native Version

0.75.0-main

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.4
  CPU: (10) arm64 Apple M2 Pro
  Memory: 79.33 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.0.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.5.1
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.04.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "34"
    Build Tools:
      - 34.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11668458
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

BUILD FAILED in 8s
error Failed to install the app. Command failed with exit code 1: ./gradlew installHermesDebug -PreactNativeDevServerPort=8081
mv: rename /var/folders/m4/63wc07xj00l5mnzjhc9xrfpr0000gn/T/tmp.unSvgiTHau/lib to /Users/bikidas/react-native/packages/react-native-codegen/scripts/oss/../../lib: No such file or directory
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy): The OLD behavior for policy CMP0026 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':packages:react-native:ReactAndroid:buildCodegenCLI'.
> Process 'command '/Users/bikidas/react-native/packages/react-native-codegen/scripts/oss/build.sh'' finished with non-zero exit value 1 * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org. BUILD FAILED in 8s.
info Run CLI with --verbose flag for more details.
npm ERR! Lifecycle script `android` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @react-native/tester@0.75.0-main
npm ERR!   at location: /Users/bikidas/react-native/packages/rn-tester

Reproducer

N/A

Screenshots and Videos

Screenshot 2024-05-07 at 6 43 00 PM
github-actions[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.
Biki-das commented 1 week ago

cc @cortinico

tarunrajput commented 1 week ago

@Biki-das, looks like the build script is unable to locate the temp lib directory at this point:

pushd "$TMP_DIR" >/dev/null

  # Note: this automatically runs build as well.
  "$YARN_BINARY" install 2> >(grep -v '^warning' 1>&2)

  popd >/dev/null

  $EDEN_SAFE_MV "$TMP_DIR/lib" "$CODEGEN_DIR"
Biki-das commented 1 week ago

? Are you able to build the android rn tester app? If yes , could you give a possible solution to my problem, have not made any changes to the repo, on the latest main branch @tarunrajput

cortinico commented 1 week ago

@Biki-das what happens if you run:

bash /Users/bikidas/react-native/packages/react-native-codegen/scripts/oss/build.sh

?

Biki-das commented 1 week ago

@cortinico it installs the script but ends with some no file/directory statement

Screenshot 2024-05-08 at 3 58 42 PM
cortinico commented 1 week ago

@cortinico it installs the script but ends with some no file/directory statement

It's failing to move a folder. Can you try to re-clone in a different folder and build again?

Biki-das commented 1 week ago

@cortinico i tried to clone it in my desktop folder, also tried to create a new folder and tried to clone it there still throws the same error. :-(

cortinico commented 6 days ago

@cortinico i tried to clone it in my desktop folder, also tried to create a new folder and tried to clone it there still throws the same error. :-(

Without further context, we can't help you more sadly. As you can see, the react-native project builds successfully on our CI, so this is definitely something related to your local environment.

Biki-das commented 5 days ago

ok thanks for helping me out, will verify the local environment once more.

Biki-das commented 2 days ago

closing this @cortinico , it got solved automatically, i recloned again a few times and it worked thanks for resolving :-)