android studio connection reset error

29,888

Solution 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:

enter image description here

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

Solution 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.

Solution 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

Solution 4

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

Solution 5

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

Share:
29,888
alireza easazade
Author by

alireza easazade

I'm a Mobile Developer. Flutter and Android native is my thing. I absolutely LOVE Flutter. I love making apps and thinking about GUI app architectures or anything that makes development and maintenance process sweeter. contact me on whatsapp email me at [email protected] or follow me on github

Updated on July 09, 2022

Comments

  • alireza easazade
    alireza easazade almost 2 years

    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

    enter image description here

    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)

    • Koorosh Ghorbani
      Koorosh Ghorbani about 7 years
      Try Kerio or Cisco for sure , Connection Reset is only related to our restrictions on our country , some times government blocks gradle ip some times gradle blocks iranian ip's and there is another possibility maybe your project using a repository which is DOWN for now .
    • alireza easazade
      alireza easazade about 7 years
      i'm trying kerio. is this dependency an issue ? classpath 'com.novoda:bintray-release:0.3.4'
    • Koorosh Ghorbani
      Koorosh Ghorbani about 7 years
      Check your gradle repos and use a VPN not proxy because most times proxies wont work as well as VPNs
    • alireza easazade
      alireza easazade about 7 years
      just did that and same problem
    • Koorosh Ghorbani
      Koorosh Ghorbani about 7 years
      Open Your Main Build.gradle not the Module Gradle file and check the repositories section :D
    • alireza easazade
      alireza easazade about 7 years
      jcenter() is all
    • Koorosh Ghorbani
      Koorosh Ghorbani about 7 years
      are you sure that you have deleted all proxy settings from gradle local file ?
  • alireza easazade
    alireza easazade about 7 years
    i did it again and changed the gradle version in my dependencies from to 2.2.2 to 2.3.0 and it solved the problem does anyone know why?
  • alireza easazade
    alireza easazade over 5 years
    dadash ye vpn khoob vasl kon hame chi hale. kerio va stunnel , baghie protocol ha ham ziad khoob nistan . faghat vpn man az vpnsaz mikharam soraatesh daghighan hamoon sorat internet khodame . ghati ham nadare.
  • Reza
    Reza over 3 years
    alireza easazade soltan laanat be in tahrima o filtera. doodesh faghat too cheshme ma mardom mire. :D
  • reddtoric
    reddtoric about 2 years
    Also, for me, I was using Kaspersky and "pausing protection" did not work. I had to completely exit Kaspersky in order for Android Studio to connect to the internet? Finally, I was able to install not installed SDK platforms and tools.