android studio connection reset error

2019-08-04 06:19发布

问题:

I've downloaded a sample project (TimePicker-master) weeks ago from GitHub and since then when ever I try to sync that project i get this error. Gradle 'TimePicker-master'project refresh failed Error: Connection reset

i have tried different proxies but it did not work. because i don't know what the problem even is? and i didn't found the reason searching online now i get the same problem when i try to download intelliJ plugins while I'm using proxies. what is the problem and how do i solve it ?(be friendly and helpful to beginners)

回答1:

the problem is not with gradle. the problem is that gradle cannot connect to the bintray servers. bintray has blocked some countries from accessing their servers .and because of that gradle cannot retrieve libraries it needs to build the project and run the application. so what do we do?

changing the IP address will do the trick.

now a word of advice to those who are new to android programming or programming in general. do not waste your time on free VPN servers or proxies which has a lot of issues like connection failure, low speed and etc . just buy a premium account from a good service and use that. it'll worth it.

like this one:

another advice is sometimes using protocols like Stunnel and cisco might still cause problems like connection timeout errors but vpn and kerio will always work ok



回答2:

Open timepicker-library's gradle file and remove below code from it and try to sync project again.

apply plugin: 'bintray-release'

dependencies {
    classpath 'com.novoda:bintray-release:0.3.4'
}

publish {
    userOrg = 'erz05'
    groupId = 'com.github.erz05'
    artifactId = 'TimePicker'
    version = '0.1.5'
    description = 'Android Library for TimePicker View'
    website = 'https://github.com/erz05/TimePicker'
}

Hope this will help you.



回答3:

try to do this add mavenCentral() to gradle:

buildscript {
    repositories {
        jcenter()
        mavenCentral()   // This repo should have the gradle plugin
    }
    dependencies {
         classpath 'com.android.tools.build:gradle:0.12.2'

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

also check if you are working offline and uncheck it



回答4:

In my case, my antivirus software was blocking it, disabling antivirus worked for me.



回答5:

i solve this problem in this way. be careful it causes with different problems like using proxy, dns connection windows , fire wall block , ....

but i use proxy in file/settings/proxy in android studio and after that i set no proxy. after that whenever use kerio vpn or cisco didnt work.

solution :go to gradle.propertices and remove every proxy script from there and sync gradle and work fine