Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Build From Source failing on 0.75.0-rc.2 #45204

Closed
WoLewicki opened this issue Jun 27, 2024 · 4 comments
Closed

[Android] Build From Source failing on 0.75.0-rc.2 #45204

WoLewicki opened this issue Jun 27, 2024 · 4 comments
Assignees
Labels
p: Software Mansion Partner: Software Mansion Partner Platform: Android Android applications.

Comments

@WoLewicki
Copy link
Contributor

Description

When trying to build the simple App from source on Android with RN 0.75.0-rc.2, the build fails with such errors:
image. It happens both on old and new arch.

Building normally works correctly on both archs.

Steps to reproduce

  1. Create new project with RN 0.75.0-rc.2.
  2. Add proper configuration for building from source: https://reactnative.dev/contributing/how-to-build-from-source#update-your-project-to-build-from-source
  3. See that the build fails

React Native Version

0.75.0-rc.2

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.4.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 168.66 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.14.0
    path: ~/.nvm/versions/node/v20.14.0/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v20.14.0/bin/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "26"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 32.1.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-29 | Google Play ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 18.0.2
    path: /opt/homebrew/opt/openjdk@18/bin/javac
  Ruby:
    version: 3.2.1
    path: /Users/wojciechlewicki/.rvm/rubies/ruby-3.2.1/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 19.0.0-rc-fb9a90fa48-20240614
    wanted: 19.0.0-rc-fb9a90fa48-20240614
  react-native:
    installed: 0.75.0-rc.2
    wanted: 0.75.0-rc.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

e: file:///Users/wojciechlewicki/work/FabricTestExample/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt:18:34 Unresolved reference: build
e: file:///Users/wojciechlewicki/work/FabricTestExample/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt:61:32 Unresolved reference: ReactBuildConfig
e: file:///Users/wojciechlewicki/work/FabricTestExample/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.kt:16:34 Unresolved reference: build
e: file:///Users/wojciechlewicki/work/FabricTestExample/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.kt:77:48 Unresolved reference: ReactBuildConfig FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native:packages:react-native:ReactAndroid:compileDebugKotlin'.

Reproducer

https://github.com/WoLewicki/reproducer-react-native/tree/%40wolewicki/75-build-from-source

Screenshots and Videos

No response

@github-actions github-actions bot added the Platform: Android Android applications. label Jun 27, 2024
@cortinico cortinico changed the title [Android][Build From Source] [Android] Build From Source failing on 0.75.0-rc.2 Jun 27, 2024
@lovegaoshi
Copy link

I encounter this as well, if I just copy ReactBuildConfig.java into com.facebook.react.common.build.ReactBuildConfig it would get pass this; but then I got autolinking fail error messages
In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GenerateAutolinkingNewArchitecturesFileTask' property 'autolinkInputFile' specifies file './RNTPExampleNewArch/android/build/generated/autolinking/autolinking.json' which doesn't exist.

@cortinico
Copy link
Contributor

cortinico commented Jun 27, 2024

Ok I know what happen.

There should have been a .gitignore change that added build/ at the top level.
That resulted in the packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/build/ from being excluded all together, so you're actually missing that ReactBuildConfig file.

I'll send over a fix tomorrow

@cortinico
Copy link
Contributor

I'll send over a fix tomorrow

That was easier said than done :( It seems the .gitconfig and .npmconfig are set correctly so I'm unsure what's causing the removal of the packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/build/ folder before we package the NPM package.

@cortinico
Copy link
Contributor

@j-piasecki did some investigation and it seems to be related to the npm version being different between CCI and GHA. As we migrated recently, this caused this issue.
We'll be fixing it in the next RC of 0.75

@github-project-automation github-project-automation bot moved this from Inbox to Done / Picked in React Native 0.75 Releases Jul 4, 2024
@cortinico cortinico assigned cortinico and cipolleschi and unassigned cipolleschi Jul 8, 2024
cipolleschi pushed a commit that referenced this issue Jul 8, 2024
…45279)

Summary:
Changes `.npmignore` file to only exclude the `ReactAndroid/build` directory instead of all `build` directories under `ReactAndroid` (which included the `ReactAndroid/src/main/java/com/facebook/react/common/build` package). This problem was caused by the newer version of NPM being used.

Closes #45204

## Changelog:

[ANDROID] [FIXED] - Fixed build from source failing due to a missing file

Pull Request resolved: #45279

Test Plan:
Run `npm pack` or `npm publish -dry-run`.

Before this change it includes 3774 files in the package and `ReactBuildConfig` isn't included. After this change it includes 3775 files in the package and `ReactBuildConfig` is included.

Reviewed By: javache

Differential Revision: D59371555

Pulled By: cortinico

fbshipit-source-id: f54f1e88e30429d538b9e160e6ce20d994c5d1b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: Software Mansion Partner: Software Mansion Partner Platform: Android Android applications.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants