Problem--> failed syncing project with gradle files
I am working on a React Native project and encountering an issue with my settings.gradle file during the build process. Here’s the error I receive when the gradle files fail to sync:
Settings file 'C:\Users\andre\WatchList\android\settings.gradle' line: 2
A problem occurred evaluating settings 'WatchList'.
> Could not read script 'C:\Users\andre\WatchList\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' as it does not exist.
Questions:
What I've Tried:
Reinstalling Dependencies
npm install
Checking node_modules Directory: I verified that @react-native-community/cli-platform-android exists in node_modules. It seems to be missing the native_modules.gradle file.
Clearing Cache and Reinstalling:
I tried clearing the cache using...
npm cache clean --force
And also deleted the node_modules folder.
Then I reinstalled dependencies...
npm install
Validating settings.gradle: Here's the content of my settings.gradle:
rootProject.name = 'WatchList'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
Environment: React Native, v0.76.3 Node.js, v20.14.0 npm, 10.8.2 Windows 11
Problem--> failed syncing project with gradle files
I am working on a React Native project and encountering an issue with my settings.gradle file during the build process. Here’s the error I receive when the gradle files fail to sync:
Settings file 'C:\Users\andre\WatchList\android\settings.gradle' line: 2
A problem occurred evaluating settings 'WatchList'.
> Could not read script 'C:\Users\andre\WatchList\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' as it does not exist.
Questions:
What I've Tried:
Reinstalling Dependencies
npm install
Checking node_modules Directory: I verified that @react-native-community/cli-platform-android exists in node_modules. It seems to be missing the native_modules.gradle file.
Clearing Cache and Reinstalling:
I tried clearing the cache using...
npm cache clean --force
And also deleted the node_modules folder.
Then I reinstalled dependencies...
npm install
Validating settings.gradle: Here's the content of my settings.gradle:
rootProject.name = 'WatchList'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
Environment: React Native, v0.76.3 Node.js, v20.14.0 npm, 10.8.2 Windows 11
Try to open another project and copy the missing file from it to your current project. It works just well