close

[Solved] Flutter problems: “Could not resolve all artifacts for configuration ‘:classpath’ ”

Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. Flutter problems: “Could not resolve all artifacts for configuration ‘:classpath’ ” in a flutter. So today Here I come with all possible solutions for this error.

We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

How Flutter problems: “Could not resolve all artifacts for configuration ‘:classpath’ ” Error Occurs ?

I am trying to run a flutter app I am writing on my device but when I try to run, I never get past the “assembleDebug” stage and get this message in the terminal:

Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:5.6.2.

How to Solve Flutter problems: “Could not resolve all artifacts for configuration ‘:classpath’ ” Error?

  1. How to Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error?

    To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level.

  2. Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error

    To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level.

Solution 1

The only problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don’t do this for flutter apps. I solved it with the following versions On build.gradle module level.

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

On build.gradle app level:

compileSdkVersion 28
targetSdkVersion 28

On gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

By the way, I got all those versions by creating a new flutter app on 1.20 stable version.

Solution 2

you can use this in you build.gradle

    buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
        maven {
            url 'http://storage.googleapis.com/r8-releases/raw'
        }
    }

    dependencies {
        classpath 'com.android.tools:r8:2.1.75'
        classpath 'com.google.gms:google-services:4.3.2'
        classpath 'com.android.tools.build:gradle:4.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Summery

So, It’s All About This Error. I hope this tutorial helps you to Solve your error. Please Comment Below if You stucks anywhere with my code. And please comment below on which solution worked for you. Thank You.

Also Check Out Below Tutorials

Leave a Comment

%d bloggers like this: