react-native icon indicating copy to clipboard operation
react-native copied to clipboard

building android build for the react native tester app is failing

Open Biki-das opened this issue 9 months ago • 10 comments

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/[email protected]
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

Biki-das avatar May 07 '24 13:05 Biki-das

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

github-actions[bot] avatar May 07 '24 13:05 github-actions[bot]

cc @cortinico

Biki-das avatar May 07 '24 13:05 Biki-das

@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"

tarunrajput avatar May 07 '24 17:05 tarunrajput

? 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

Biki-das avatar May 07 '24 17:05 Biki-das

@Biki-das what happens if you run:

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

?

cortinico avatar May 08 '24 10:05 cortinico

@cortinico it installs the script but ends with some no file/directory statement Screenshot 2024-05-08 at 3 58 42 PM

Biki-das avatar May 08 '24 10:05 Biki-das

@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?

cortinico avatar May 10 '24 23:05 cortinico

@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. :-(

Biki-das avatar May 12 '24 13:05 Biki-das

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

cortinico avatar May 14 '24 00:05 cortinico

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

Biki-das avatar May 14 '24 05:05 Biki-das

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

Biki-das avatar May 17 '24 14:05 Biki-das