1

I am calling https webservice and its works fine in all other versions of Android, but now, when i am trying to call it with Android 7.0 Nougat, it gives me following error.

Error : javax.net.ssl.SSLHandshakeException: Connection closed by peer

I already tried with HttpClient and HttpsURLConnection, but i got the same error.

I used Security with HTTPS and SSL provided by google, but got the same error in Android 7.0 Nougat

Amit Rautela
  • 54
  • 1
  • 5
  • check this answer, works for me, solution is for Volley but can be applied to any [link](http://stackoverflow.com/a/40198170/5147817) – Stepan Maksymov Oct 23 '16 at 10:18

1 Answers1

0

By default, secure connections (using protocols like TLS and HTTPS) from all apps trust the pre-installed system CAs, and apps targeting Android 6.0 (API level 23) and lower also trust the user-added CA store by default.

Which means that on Nougat, you actually need to specify a certificate to trust into your Android project. You can add your certificate in a configuration file, as described here: https://developer.android.com/training/articles/security-config.html

IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147