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

Build failed: 'react/renderer/components/view/ViewProps.h' file not found #573

Open
GaylordP opened this issue Jan 9, 2025 · 6 comments

Comments

@GaylordP
Copy link

GaylordP commented Jan 9, 2025

Hello and thank you for your library! :)

Since yesterday morning, I haven't been able to build my project at all using the command npx react-native run-android. I keep getting this error:

node_modules/react-native-safe-area-context/android/src/main/jni/../../../build/generated/source/codegen/jni/react/renderer/components/safeareacontext/Props.h:12:10: fatal error: 'react/renderer/components/view/ViewProps.h' file not found
#include <react/renderer/components/view/ViewProps.h>

I found a topic about this, but the issue seemed to be resolved (link).

I have tried many times (more than fifteen times) to clear the Yarn, node_modules, and Gradle caches without success.

This issue appeared very suddenly yesterday morning—at 8 AM, everything was working, and by 12 PM, it had stopped working. I didn't modify any dependencies in my project; I simply cleared the caches and node_modules around noon to build a production version.

rm -rf android/.gradle android/.idea android/app/build android/build
rm -rf package-lock.json yarn.lock node_modules
npx react-native start --reset-cache
./android/gradlew clean

Here is my configuration:

  • react-native : 0.76.5
  • react-native-safe-area-context : 5.0.0
  • ndkVersion : 26.1.10909125
  • kotlinVersion : 1.9.24
  • gradle : 8.10.2

react-native info :

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1
  Memory: 99.31 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.4.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.1
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.07.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "34"
      - "35"
    Build Tools:
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-35 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /opt/homebrew/opt/openjdk@17/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.3
    wanted: ^15.1.3
  react:
    installed: 18.3.1
    wanted: ^18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Thank you in advance if you can help me, as I don't have many ideas left to debug this problem.

@ArtemLakhurov
Copy link

I have updated lib to version 5.1.0 and this error missed but I have a new one. 'react/renderer/components/view/ViewEventEmitter.h' file not found

@GaylordP
Copy link
Author

GaylordP commented Jan 9, 2025

@ArtemLakhurov I preferred to wait for React Native 0.77 before updating rn-safe-ara-context.

So, you had the same error as me with rn-safe-ara-context 5.0.0, and that’s what motivated you to try the newer version? (If so, that rules out the possibility that the problem is only on my side? ^^)

@ArtemLakhurov
Copy link

ArtemLakhurov commented Jan 9, 2025

@GaylordP Yes, But I have two errors on 5.0.0 version.

  1. 'react/renderer/components/view/ViewProps.h' file not found
  2. 'react/renderer/components/view/ViewEventEmitter.h' file not found
    Also additional details. I have this error only if I use new architecture

@amitkumar144
Copy link

I encounter an issue only when running the app directly from Android Studio. However, when I run the app using yarn android, the error disappears.

@georgi2005atanasov
Copy link

I have the same error. Did anyone solve it?

@georgi2005atanasov
Copy link

Guys, I think i found the problem. In android/build.gradle you have to explicitly point to the versions of com.android.tools.build:gradle and com.facebook.react:react-native-gradle-plugin. After that while bundling the app will throw exceptions for some libraries. Upgrade them to the latest versions. Now you should be able to build the project successfully. If not please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants