Chaque fois que j'essaie de construire un projet, cela se produit. Android studio version 3.4 La synchronisation Gradle échoue lors de la configuration de la construction
Pour une raison quelconque, il ne peut pas obtenir de ressources à l'URL. Mais je peux télécharger le fichier depuis le navigateur.
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://maven.google.com/com/Android/tools/build/gradle/3.2.1/gradle-3.2.1.jar'.
Erreur complète:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'Web2App'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.Java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.Java:66)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.Java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.Java:110)
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.Java:55)
at Java.lang.Thread.run(Thread.Java:745)
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.Java:915)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1600(DefaultConfiguration.Java:116)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.Java:889)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.Java:401)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.Java:68)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:110)
at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.Java:58)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.Java:41)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.Java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.Java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.Java:64)
... 84 more
Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download gradle.jar (com.Android.tools.build:gradle:3.2.1)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver$RemoteRepositoryAccess.resolveArtifact(ExternalResourceResolver.Java:439)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$ResolveAndCacheRepositoryAccess.resolveArtifact(CachingModuleComponentRepository.Java:409)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.BaseModuleComponentRepositoryAccess.resolveArtifact(BaseModuleComponentRepositoryAccess.Java:65)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryCachedModuleComponentRepository$CachedAccess.resolveArtifact(InMemoryCachedModuleComponentRepository.Java:124)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveArtifact(ErrorHandlingModuleComponentRepository.Java:174)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainArtifactResolver.resolveArtifact(RepositoryChainArtifactResolver.Java:80)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultArtifactSet$LazyArtifactSource.create(DefaultArtifactSet.Java:170)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultArtifactSet$LazyArtifactSource.create(DefaultArtifactSet.Java:157)
at org.gradle.api.internal.artifacts.DefaultResolvedArtifact.getFile(DefaultResolvedArtifact.Java:135)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ArtifactBackedResolvedVariant$DownloadArtifactFile.run(ArtifactBackedResolvedVariant.Java:146)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.access$900(DefaultBuildOperationExecutor.Java:63)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$ParentPreservingQueueWorker.execute(DefaultBuildOperationExecutor.Java:378)
at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.runOperation(DefaultBuildOperationQueue.Java:230)
at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.access$600(DefaultBuildOperationQueue.Java:172)
at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable$1.call(DefaultBuildOperationQueue.Java:209)
at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable$1.call(DefaultBuildOperationQueue.Java:203)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.runAll(DefaultBuildOperationExecutor.Java:130)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ParallelResolveArtifactSet$VisitingSet.visit(ParallelResolveArtifactSet.Java:60)
... 139 more
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://maven.google.com/com/Android/tools/build/gradle/3.2.1/gradle-3.2.1.jar'.
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.Java:96)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.Java:80)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performGet(HttpClientHelper.Java:84)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.Java:43)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.Java:29)
at org.gradle.internal.resource.transfer.DefaultExternalResourceConnector.openResource(DefaultExternalResourceConnector.Java:56)
at org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceAccessor.openResource(ProgressLoggingExternalResourceAccessor.Java:36)
at org.gradle.internal.resource.transfer.AccessorBackedExternalResource.withContentIfPresent(AccessorBackedExternalResource.Java:130)
at org.gradle.internal.resource.BuildOperationFiringExternalResourceDecorator$11.call(BuildOperationFiringExternalResourceDecorator.Java:237)
at org.gradle.internal.resource.BuildOperationFiringExternalResourceDecorator$11.call(BuildOperationFiringExternalResourceDecorator.Java:229)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:350)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:340)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.Java:120)
at org.gradle.internal.resource.BuildOperationFiringExternalResourceDecorator.withContentIfPresent(BuildOperationFiringExternalResourceDecorator.Java:229)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.Java:199)
... 148 more
Caused by: Java.net.SocketException: Software caused connection abort: recv failed
at Java.net.SocketInputStream.socketRead0(Native Method)
at Java.net.SocketInputStream.socketRead(SocketInputStream.Java:116)
at Java.net.SocketInputStream.read(SocketInputStream.Java:170)
at Java.net.SocketInputStream.read(SocketInputStream.Java:141)
at Sun.security.ssl.InputRecord.readFully(InputRecord.Java:465)
at Sun.security.ssl.InputRecord.read(InputRecord.Java:503)
at Sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.Java:973)
at Sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.Java:930)
at Sun.security.ssl.AppInputStream.read(AppInputStream.Java:105)
at org.Apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.Java:139)
at org.Apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.Java:155)
at org.Apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.Java:284)
at org.Apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.Java:140)
at org.Apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.Java:57)
at org.Apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.Java:261)
at org.Apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.Java:165)
at org.Apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.Java:167)
at org.Apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.Java:272)
at org.Apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.Java:124)
at org.Apache.http.impl.execchain.MainClientExec.execute(MainClientExec.Java:271)
at org.Apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.Java:184)
at org.Apache.http.impl.execchain.RetryExec.execute(RetryExec.Java:88)
at org.Apache.http.impl.execchain.RedirectExec.execute(RedirectExec.Java:110)
at org.Apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.Java:184)
at org.Apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.Java:82)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.Java:148)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.Java:126)
at org.gradle.internal.resource.transport.http.HttpClientHelper.executeGetOrHead(HttpClientHelper.Java:103)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.Java:94)
... 163 more
Ci-dessous le fichier gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
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
}
}
ext {
supportlib_version = '28.0.0'
gps_version = '[16.0.0, 17.0.0)'
fb_version = '[15.0.0, 17.0.0)'
}
//Ensure that all dependencies use the same version of the Android Support library
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.Android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version"
}
if (details.requested.group == 'com.google.Android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$gps_version"
}
if (details.requested.group == 'com.google.firebase'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$fb_version"
}
}
}
}
allprojects {
repositories {
google()
jcenter()
}
}
J'ai essayé de suivre.
La toute première chose que je suppose, il pourrait y avoir un pare-feu bloquant la connexion de Android Studio.
Si c'est le cas, essayez de le désactiver pendant un bref instant et testez à nouveau. Si cela fonctionne, vous voudrez peut-être ajouter Android Studio à votre liste blanche de pare-feu.
Notez que
allprojects {
repositories {
google()
jcenter()
}
}
et
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
sont différents, vous devez également mettre google()
en haut pour buildscript {repositories { } }
: i.e.
buildscript {
repositories {
google() // <-- here
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
Que votre téléchargement n'ait pas été fait avec succès
Supprimer le cache gradle et les dists à $HOME
dossier
rm -r $HOME/.gradle/caches $HOME/.gradle/dists/*
Essayez de le télécharger à nouveau.