We are currently working with React-Native 0.68.5, Windows 10 and are getting this error when trying to build the gradle file:
Could not resolve all task dependencies for configuration ‘:classpath’.
> Could not find com.facebook.react:react-native-gradle-plugin:.
So far we have tried different versions of com.android.tools.build:gradle, as well as installing ‘react-native-gradle-plugin’ manually to package.json, also tried deleting the ‘.gradle’ folder and rebuilding it but so far none have worked. Looking for insights from anyone who has faced this issue before and how you were able to resolve it
(https://i.stack.imgur.com/5cKSj.png)
(https://i.stack.imgur.com/LEqmq.png)
7
Answers
./gradlew clean
commandAfter you reinstall node_modules with updated package.json to support latest (0.71) react native, you need to edit your settings.gradle file by adding this line:
Then go to Android folder. And clean the Android folder using ./gradlew clean command and run build, maybe this will help fix your issue.
Deleting the node_modules folder and re downloading it worked for me.
Instead of opening cmd in normal mode, open cmd in Run As Administrator mode. This is how I fixed the issue:
npx react-native run-android
Note:- If you are creating a new application using CLI, open cmd in Run As Administrator mode. The syntax of command used to create a new application is:
npx react-native init Project_Name
Simply deleting node_modules and runing
npm install
works for meThe first thing you need to do is try to delete your .gradle folder and then run your project again.
If you still face the same error, then try to delete your node_modules folder and then add your packages again by running yarn install or npm install whatever package manager you are using and after that run your project again.
After removing the following code in android/build.gradle it worked:
NOTE: if above answer is not working so please try this one (remove this code)