androidandroid-studiogradlebuild.gradle

Android studio 3.2.1 ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'


After I update Android Studio to 3.2.1 and gradle version in my project I am getting following build error.

I have already checked lots of questions related this question but no luck.

Project dependency Build.gradle

buildscript {

    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        gradlePluginPortal()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        maven { url "https://jitpack.io" }
        jcenter ()

    }
}

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

Error

org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'DemoAppppp'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:944)

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.2.1.
Required by:
    project :
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:103)
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:63)

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.2.1.
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:139)

Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
    at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
    at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)

Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
    at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:96)

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect 
Caused by: java.net.ConnectException: Connection refused: connect 

Update

I just followed @CoolMind answer it solve the gradle issue, but there is another issue comes which is This

And I followed those answers which is given in this question but not solve my problem


Solution

  • Just turn off the Toggle Offline Mode .

    On the top right side of the Window .

    Click on Gradle 2nd number option(just near of Setting option) click on it then you will be able to do work continuously.

    As you can see the image

    enter image description here