Ritu Nagpal
Ritu Nagpal

Reputation: 161

com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: Handshake failed

Using volley for basic network operations,getting no connection handshake error when adding the project as an module.

While the module works fine in some another project.

On R&D, added retrypolicy but no use still getting the same error.

Here is my code. https://gist.github.com/fizzysoftware/a895bc2cbd1ad9a048277859f3f23963

Upvotes: 3

Views: 5738

Answers (3)

Fahad Ali
Fahad Ali

Reputation: 51

Changing the url from Https to Http will work.

Upvotes: 3

Sujai
Sujai

Reputation: 208

In my project also same issues are faced. In Marshmallow its work suffecfully. But in Kitkat version it raised the issue

"com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: Handshake failed"

For Handling this I used google's auth dependencies. Kindly add the following dependency in your Gradle

compile 'com.google.android.gms:play-services-auth:11.0.2'

And Implement the method for Installing Security Provider in Lower versions, If instalation's required

private void updateAndroidSecurityProvider(Activity callingActivity) {
try {
    ProviderInstaller.installIfNeeded(this);
} catch (GooglePlayServicesRepairableException e) {
    // Thrown when Google Play Services is not installed, up-to-date, or enabled
    // Show dialog to allow users to install, update, or otherwise enable Google Play services.
    GooglePlayServicesUtil.getErrorDialog(e.getConnectionStatusCode(), callingActivity, 0);
} catch (GooglePlayServicesNotAvailableException e) {
    Log.e("SecurityException", "Google Play Services not available.");
}

}

Then call the method in your activity, before making network operations.

Upvotes: 0

Malik
Malik

Reputation: 904

It could be one of these two cases:

  1. You try to connect to an HTTP url but it's actually an HTTPS url, or
  2. You try to connect to an HTTPS page but the certificate is not valid.

These are at least the cases I've encountered so far...

Upvotes: 4

Related Questions