31

When I build the project I receive the following error Error:SSL peer shut down incorrectly please let me know how to fix this error

Ahmed Rajab
  • 603
  • 3
  • 10
  • 28
Rahul Wadhai
  • 413
  • 1
  • 4
  • 9
  • 3
    Possible duplicate of [Android SDK manager SSL peer shut down incorrectly](https://stackoverflow.com/questions/11571201/android-sdk-manager-ssl-peer-shut-down-incorrectly) – Mr. Roshan Jun 27 '18 at 12:30

16 Answers16

21

It's probably a certificate problem, I had similar issue with Android Studio and I solved it by following these steps:

1 - Open gradle-wrapper-properties file and modify https:// to http://

2 - Force using http instead of https in Android SDK Manager, just click on SDK Manager icon above on Android Studio Toolbar and go to SDK Update Sites tab.

3 - Go to File -> Settings. In the IDE Settings section select Server Certificates, then check accept non-trusted certificates automatically. If the problem persist, then you should add the certificates to Android Studio, like *.google.com certificate. In my case I tried to add multiple certificates but I still get SSL Error, After I opened https://services.gradle.org in my browser and I imported the certificate to Android Studio, Anyhow adding this as an SSL exception resolved the issue for me.

If the problem persist, I recommend to configure a proxy to just install the desirable dependencies. Open Gradle properties for proxy settings and add the following:

systemProp.http.proxyHost=x
systemProp.https.proxyPort=y
systemProp.https.proxyHost=x
systemProp.http.proxyPort=y
iLyas
  • 1,047
  • 2
  • 13
  • 30
21

My problem was solved Clean Project and then `Rebuild Project.. Hope this helps you,,

5

You have a slow Internet Connection & Your Android Studio Build got interrupted. Try to build in offline mode or fix your internet

user987760
  • 1,061
  • 3
  • 12
  • 26
5

For fixing this problem you can use a vpn.

Benyamin
  • 1,008
  • 11
  • 18
2

Files -> Invalidate cashes / restart -> Invalidate and Restart.

This will solve the problem.

kalandar
  • 793
  • 6
  • 13
1

after testing other answers and nothing happened, I try a trick open another project that is synced successfully, find gradle version and gradle plugin version and use those in current project

project structure menu button just copy gradle version and gradle plugin version and use them in other project and sync

enter image description here

Hamid Zandi
  • 2,714
  • 24
  • 32
1

This may not be a generic answer, but I was able to solve it this way. If you're using the security software Kaspersky, try closing it and then running it.

  • thank you so much, everytime I had this problem, I have to reboot my mac (under sierra) now I just exit kaspersky and the job is done ;) – Nabil Ait Brahim Jul 08 '20 at 13:25
1

Please check your internet and try again

mmfarzaneh
  • 381
  • 1
  • 11
1

It is related to your Internet connection;

First Solution : Check your connection and turn off proxy, if you are using.

Second Solution : Change your proxy region to another and try again.

sina akbari
  • 618
  • 6
  • 7
0

Go to Android SDK manager and update with latest SDK. After downloading just re syncy and error will be gone

0

Try to clean your project. If the problem does not solved use a proxy and sync your gradle and rebuild the project(if you are already using proxy server try to use an other one and be sure that your internet connection is stable).

0

Go to SDK Manager , then select SDK Update Sites and lastly Mark/Tick "Force https://....'

0

I don't know if it has to do, but I removed the VCS and resynced, it took a lot of time, then I clicked on the syncing process and I resumed something that was paused. Then it worked.

YoussefDir
  • 287
  • 1
  • 3
  • 16
0

Hey Just update the classpath to latest version available I solved the error by this just write classpath 'com.android.tools.build:gradle:your.latest.version'

0

I had the same problem and it was solved when I disabled the windows firewall

-1

"SSL peer shut down incorrectly" - sometimes happens for slow internet connection, as well as when the server response is interrupted for connection problems.

So, in my case,

  1. I have a slow Internet Connection
  2. Android Studio Build got interrupted.

So I have joined with a strong network connection and the problem was gone. It was a network connection error for poor network in my case.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Noor Hossain
  • 1,620
  • 1
  • 18
  • 25