Build failed: 'react/renderer/components/view/ViewProps.h' file not found
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.
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
@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? ^^)
@GaylordP Yes, But I have two errors on 5.0.0 version.
- 'react/renderer/components/view/ViewProps.h' file not found
- 'react/renderer/components/view/ViewEventEmitter.h' file not found Also additional details. I have this error only if I use new architecture
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.
I have the same error. Did anyone solve it?
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!
I am using "react": "18.3.1", "react-native": "0.77.0", "react-native-safe-area-context": "^5.1.0",
when running for IOS i am getting this error and not able to run it at all have been trying it for 2 days now
node_modules/@react-native-community/progress-view/common/cpp/react/renderer/components/progressview/RNCProgressViewState.h:3:10
'react/renderer/components/progressview/Props.h' file not found
Any solutions please... @georgi2005atanasov @ArtemLakhurov @GaylordP
The problem is within the versions... try to update to the latest ones. Also, if you are using an emulator, It can cause an unexpected behavior.
Same issue for me
This is the blocker for us. Anyone have any solution ?
Could I get someone to try on the latest versions of RN and this library. The original post is correct with needing the gradlew clean and various cache clearing mechanisms. Could you also try gradlew cleanAll?
The issue is probably that React Native hasn't run its codegen step successfully - or it never ran it and doesn't think it has to
I had this issue out of nowhere, when it had been building just fine before (with the exact same settings). Switching off newArchitecture, building (successful) then turning new architecture on again seemed to fix my version of the issue
So most likely a caching issue. Is it only this project, or do other projects exhibit similar issues?
Got the same problem
I’m not exactly sure why, but I was using [email protected] with @react-native/[email protected]. After downgrading @react-native/gradle-plugin to 0.75.5 to match the React Native version, the build issue was resolved.
Any fix even upgrade safe area context to 5.4.0 (latest) version. Still facing same on iOS ?
Check your yarn.lock file for this section react-native@npm:*, it should match your current RN version.
(Mine was separate and lower from the version I'm running/upgrading to and was causing the issue)
For anyone else is still facing this problem. I can confirm @bakhiem 's answer works for me. I update the react-native to 0.78.3 recently to solve the supporting 16Kb Page Size, and I forgot my @react-native/gradle-plugin was still 0.75.5. After change version to 0.78.3 to match the react-native version. I deleted lock files (both package-lock.json and yarn.lock if you are using both). Then delete all the build folder and even .gradle folder (just to make sure everything is clean). I re-run the build and the problem is gone. Couldn't be happier cause i stuck on this for a very long time
I’m not exactly sure why, but I was using [email protected] with @react-native/[email protected]. After downgrading @react-native/gradle-plugin to 0.75.5 to match the React Native version, the build issue was resolved.