添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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

check your connectivity while building gradle for project, also make sure you are not behind any firewall. – karan Dec 26, 2018 at 12:42 if you're in a sanctioned country use vpn/proxy that covers the whole PC restart Android Studio and make sure google() is first option and mavenCentral() is second – Alireza Jamali Dec 30, 2022 at 15:26

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

thanks.i faced this issue due to internet connectivity and gradle went offline mode. now after changing it back to onlilne its working fine – Jasbin Karki May 13, 2020 at 3:37 It is hard to tell whether you are in 'offline' or not offline mode. I think having the little interrupted horizontal bar means offline. Having a gray box around the bar means not-offline -- ie online. Having the tool tip just say toggle offline doesn't help. Seeing it in a dark theme is hard too. – Ribo May 20, 2020 at 22:04 Doesn't work for me. Toggling offline mode makes no difference whatsoever. I think you should take out the 100% solution part! – gignu May 16, 2022 at 17:39 @Vikassingh no, I get exactly the same error message as in the title of this question. The solution in my case was to upgrade my FLIPPER_VERSION in my gradle.properties file which was outdated. Once I did that, the error was gone and the build succeeded. If you're interested and want to reproduce it, change your FLIPPER_VERSION to 0.52.1 and you should get the same build error as in the title of this question. – gignu May 17, 2022 at 15:59

In The Right Side of the Android Studio, You can See Gradle option just click it and you will see a screen which is given below.

Gradle can be offline. If offline, you should do it online.

For me androidx.camera:camera-mlkit-vision:1.2.1. Maybe I've written the wrong version number. But I suppose this was in some ML Kit part of the docs. – Daniel Galion Mar 4 at 11:17 This. The real issue was one step above in the error tree, not the error from the title of this post. – George Mar 18 at 22:47

I had this problem also. Tried all the suggestions, but didnt help. The problem was in offline/online mode as other stated but you have to also check the compiler settings. Make sure there is no --offline flag

Preferences -> Build, Execution, Deployment -> Compiler

( Menubar 'File' button, 'Settings' menu option, 'Build, Execution, Deployment' menu twisty, 'Compiler' submenu )

On Command-line Options: --stacktrace

--offline --stacktrace

Opening the "Gradle" side panel, and toggling the "online/offline" button to "online" worked for me as well.

Previous failed solution: I searched on Gradle's website for a manual download of version 3.6.3, but there wasn't one. That number is the same version, however, of Android Studio being used.

This problem appeared on OS X. After disabling web filtering application (some Google IPs were blocked) it disappeared. After syncing with gradle all files have been downloaded.

Also you may set a checkbox like in https://discuss.gradle.org/t/android-studio-could-not-get-resource-https-dl-google-com-dl-android-maven2-com-android-tools-build-gradle-3-1-0-gradle-3-1-0-pom/26734:

Settings -> Build … -> Gradle -> Android Studio -> Enable embedded maven repository.

See also Could not resolve com.android.tools.build.gradle:3.0.1.

Thank you for your answer. It solves the gradle issue, but there is one more problem occurs which is this. – Vikas singh Jan 6, 2019 at 8:14

If you have updated Gradle then most likely you will get this error because Gradle will be offline by default after updating.

Solution:

In right hand side top corner click Gradle (Gradle panel or Gradle window opens). Connect Gradle to the internet by clicking the icon at the top of Gradle panel or window.

This problem occurs when your android studio is not getting internet connection. You fix the internet, the problem fixes by itself. To confirm the internet issue of the android studio you can attempt to login, update, connecting to firebase, etc all will fail.

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. – Community Mar 16, 2022 at 16:38

I also have been having the same error since when i updated my Android studio and even with a fast internet network am unable to start a new project but today I discover a solution just click o your event log and update any suggested plugin that shows up and rebuild your project, then your have your project working well and fine it worked for me trust it to work for you also .

Welcome to StackOverflow, add some more description and code if it's required to understand the answer because it will resolve someone's else problem ASAP. – Nensi Kardani May 13, 2020 at 4:23

Try to Toggle Offline Mode, if not worked check your flipper version if it is old try to update it(worked for me). Upgrading flipper version in gradle.properties

FLIPPER_VERSION=0.39.0
FLIPPER_VERSION=0.99.0

In my case I added maven repository in both repository section , so this issue occurs, So I removed this line from above repotories section inside buildscript for reference visit this answer https://stackoverflow.com/a/75005827/12748481