【发布时间】:2018-10-03 11:09:59
【问题描述】:
04-23 17:17:38.434 21599-21956/ D/NativeCrypto: ssl=0x0 NativeCrypto_SSL_interrupt
04-23 17:17:38.435 21599-21956/ D/OkHttp: <-- HTTP FAILED: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x635d8808: Failure in SSL library, usually a protocol error
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:744 0x5e6c46fd:0x00000000)
Android 低版本设备 (4.1 - 4.4) 出现 SSL 错误。以前使用以下版本可以正常工作:
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
但是在升级这些库之后,情况发生了变化。每个服务调用都会产生 SSL 握手异常。
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.4.0'
此外,如果我将这些库降级到以前的版本,它仍然无法工作。但是 git checkout 到上一个提交工作正常。毫无头绪。
【问题讨论】:
-
您是否在密钥库中添加了证书?
-
@Lucifer 我想我没有。你指的是哪个证书?
-
你使用的是SSL,所以服务器端应该有一个安全证书。
-
服务器甚至没有被调用。服务在 android 端被阻止
-
您应该将其添加为答案,而不是更新您的问题。这样,它将帮助未来的访问者。
标签: android retrofit retrofit2 okhttp okhttp3