3

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

Ritu Nagpal
  • 161
  • 1
  • 11

3 Answers3

4

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

Malik
  • 878
  • 2
  • 9
  • 23
3

Changing the url from Https to Http will work.

Fahad Ali
  • 51
  • 1
  • 6
0

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.

Sujai
  • 208
  • 2
  • 6