splinter123
splinter123

Reputation: 1203

SSL Handshake fails connecting to Google from Android client

I'm using the standard piece of code

URL url = new URL(sb.toString());
conn = (HttpsURLConnection) url.openConnection();
InputStreamReader in = new InputStreamReader(conn.getInputStream());

to connect to the Google Places API from an Android client. However I get this exception:

02-24 02:29:35.535: E/AdapterClass(3122):   at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:374)
02-24 02:29:35.535: E/AdapterClass(3122):   at com.android.okhttp.Connection.upgradeToTls(Connection.java:197)
02-24 02:29:35.535: E/AdapterClass(3122): Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xaf85c200: Failure in SSL library, usually a protocol error
02-24 02:29:35.535: E/AdapterClass(3122): error:1407743E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert inappropriate fallback (external/openssl/ssl/s23_clnt.c:765 0xac3f9e61:0x00000000)

Any ideas? I noticed this only happens when I use OkHttp for requests, but not for this particular request but in other parts of my app. So why would okhttp play a role here (as shown in the stacktrace)?

Upvotes: 5

Views: 1161

Answers (1)

splinter123
splinter123

Reputation: 1203

This problem gets solved by switching to the latest version (2.2 as of now) of OkHttp (I was using 1.6 before).

Upvotes: 1

Related Questions