skip to Main Content

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)

(https://i.stack.imgur.com/nhPZX.png)

(https://i.stack.imgur.com/nK4Gl.png)

7

Answers


    1. Try deleting all of your node_modules folder in your project.
    2. Go to Android folder. And clean the Android folder using ./gradlew clean command
    3. rebuild the app on project root folder
    Login or Signup to reply.
  1. After 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:

    includeBuild(‘../node_modules/react-native-gradle-plugin’)

    Then go to Android folder. And clean the Android folder using ./gradlew clean command and run build, maybe this will help fix your issue.

    Login or Signup to reply.
  2. Deleting the node_modules folder and re downloading it worked for me.

    Login or Signup to reply.
  3. Instead of opening cmd in normal mode, open cmd in Run As Administrator mode. This is how I fixed the issue:

    1. Open cmd (Command Prompt) in Run As Administrator mode
    2. Run the command : npx react-native run-android
    3. And rest of the steps remain the same.

    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

    Login or Signup to reply.
  4. Simply deleting node_modules and runing npm install works for me

    Login or Signup to reply.
  5. The 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.

    Login or Signup to reply.
  6. After removing the following code in android/build.gradle it worked:

    exclusiveContent {
                   filter {
                       includeGroup "com.facebook.react"
                   }
                   forRepository {
                       maven {
                           url "$rootDir/../node_modules/react-native/android"
                       }
                   }
            }
    

    NOTE: if above answer is not working so please try this one (remove this code)

    allprojects {
        configurations.all {
            resolutionStrategy {
                force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
            }
        }
        ```
        
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search