Flutter problems: "Could not resolve all artifacts for configuration ':classpath' "

Sometime you need to run flutter pub upgrade.


You're trying to use actual Gradle. For Android development, there's Android Gradle which is currently on version 3.5.3 which came out this month. Read this article: https://developer.android.com/studio/releases/gradle-plugin#3-5-0.

EDIT: To use the latest version of Android Gradle (3.5.3), you need Gradle versions between 5.4.1-5.6.4 which you can configure in the gradle-wrapper.properties file. I guess Android Gradle doesn't yet support Gradle 6.


The problem probably was caused by updating the gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I had the same issue and I solved 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.