'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 1:[1]
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.
Solution 2:[2]
Solution 3:[3]
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
not
--offline --stacktrace
Solution 4:[4]
In my case, I have added a dependency which is not available in any of the cloud repositpories. On removing dependency,it started working
Solution 5:[5]
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.
Solution 6:[6]
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.
Solution 7:[7]
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.
Solution 8:[8]
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.
Solution 9:[9]
upgrade project to androidx change compile to implementation change v4 or v7 to androidx dependencies
Solution 10:[10]
My problem was because a version was wrong in the dependencies in build.gradle (app). If you have internet, it might be because of this, so try finding other warnings that might indicate a wrong dependency.
Solution 11:[11]
Just you have to turn on the Toggle button, come in the grade menu at the right side of the window... So you going to online mode.. you must have internet connection for.. build grade.. otherwise it's again show you same error or other types of error...
Solution 12:[12]
For me, the issue was organization's Artifactory password got changed needed to update Gradle with new credentials.
Solution 13:[13]
You might have added a dependency not available in the repository
Solution 14:[14]
Solution 15:[15]
This error may arrises due to "android:exported="false"". please make sure when to use "android:exported="true/false"".
Solution 16:[16]
In my case none of the above helped. I had to upgrade my FLIPPER_VERSION in my gradle.properties file. You can find the latest FLIPPER_VERSION here: https://github.com/facebook/flipper/releases
Solution 17:[17]
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 .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow



