Gradle Connection timed out

匿名 (未验证) 提交于 2019-12-03 03:03:02

问题:

after updating android studio 2.3 to 3.0 i got lots of errors so many work i done it but didn't work

Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not resolve com.android.support:appcompat-v7:26.1.0. Required by: project :app Could not resolve com.android.support:appcompat-v7:26.1.0. Could not parse POM https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom Already seen doctype. Could not resolve com.android.support:appcompat-v7:26.1.0. Could not get resource 'https://jcenter.bintray.com/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'. Could not HEAD 'https://jcenter.bintray.com/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect

gradle wrapper properties

#Mon Nov 06 17:20:27 IRST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip  

my gradle (module app)

 apply plugin: 'com.android.application'  android {     compileSdkVersion 26     defaultConfig {         applicationId "curlpagetutorial.example.com.mydd"         minSdkVersion 19         targetSdkVersion 26         versionCode 1         versionName "1.0"         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     implementation fileTree(dir: 'libs', include: ['*.jar'])     implementation 'com.android.support:appcompat-v7:26.1.0'     implementation 'com.android.support.constraint:constraint-layout:1.0.2'     testImplementation 'junit:junit:4.12'     androidTestImplementation 'com.android.support.test:runner:1.0.1'     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } 

gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.  buildscript {      repositories {         google()         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:3.0.0'           // NOTE: Do not place your application dependencies here; they belong         // in the individual module build.gradle files     } }  allprojects {     repositories {         google()         jcenter()     } }  task clean(type: Delete) {     delete rootProject.buildDir } 

New errors

Required by: project :app

Could not resolve com.android.support:appcompat-v7:26.1.0. Could not parse POM https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom Already seen doctype.

Could not resolve com.android.support:appcompat-v7:26.1.0.

Could not resolve com.android.support.test:runner:1.0.1.

Could not resolve com.android.support.test.espresso:espresso-core:3.0.1.

I'm stuck here for long time please help me

回答1:

Download gradle from:http://services.gradle.org/distributions/

choose the file such as gradle-4.1-rc-1-all.zip

Find your gradle directory in AndroidStudio setting-->Build,Execution,Deployment -->Gradle

Unzip the file to "(your gradle path)\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew"



回答2:

Ihave had the same problem. Finally I fixed it ussing an external gradle instalation. To make it you need to configure File->Settings->Build,Execution and deployments->Gradle Check -> Use local gradle distribution Select gradle home instalation.

If you are using an corporative connection, you also have to configure gradle proxy properties configuring or creating file gradle.properties in folder "/Users/user/.gradle":

#http proxy setup systemProp.http.proxyHost=url systemProp.http.proxyPort=port systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost  #https proxy setup systemProp.https.proxyHost=url systemProp.https.proxyPort=port systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost 

That's all!



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!