'flutter problem: "Could not resolve all files for configuration ':classpath'."

I run simple flutter "show random word" project but i have this error: enter image description here

this is my gradle-wrapper.properties file:

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

and this is my build.gradle file:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

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

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

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

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

what should i do?



Solution 1:[1]

Here you are using the latest Gradle version -

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

for this, you also need the latest plugin version too -

classpath 'com.android.tools.build:gradle:4.1.0'

change this Gradle version plugin into -

 classpath 'com.android.tools.build:gradle:7.0.0'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Harsh Mantri