Closed yangdengxueshi closed 11 months ago
请提供url
用RxHttp demo在android 13的设备上可以访问
用RxHttp demo在android 13的设备上可以访问
OK,谢谢你的回复,我把RxHttp版本和OkHttp版本调成跟你一样试一下,伊拉克的客户用RealMe手机,ColorOS13,Android13系统,访问不起,我再看看情况,感谢
用RxHttp demo在android 13的设备上可以访问
记录一下我的最终解决方案,方便同行避坑,排查了整整一天才找到原因:
问题描述:国内13+系统上用RxHttp请求https一切正常,国外13+系统上请求https报 SSL HandShake Exception (Caused by: javax.net.ssl.SSLHandshakeException: Read error: ssl=0x71b958c9db58: Failure in SSL library, usually a protocol error)
问题原因:国内手机没有GMS谷歌服务,国外手机有GMS,所以13+系统上,国外发送网络请求时,手机还需要向GMS谷歌服务请求授权
问题解决方法:
implementation 'com.google.android.gms:play-services-auth:20.7.0'
BaseApplication 中:
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) && (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS)) {// 13+设备支持GMS服务
try {
ProviderInstaller.installIfNeeded(this);
} catch (Exception e) {
e.printStackTrace();
}
}
解决方法就是这么简单,参考链接: https://stackoverflow.com/questions/29916962/javax-net-ssl-sslhandshakeexception-javax-net-ssl-sslprotocolexception-ssl-han https://developer.android.com/training/articles/security-gms-provider?hl=zh-cn 链接如果访问不了,请开启VPN
以上忽略证书、忽略主机验证写法,在安卓12-手机上没问题,在安卓13+以上握手错误,怎么回事?
报错信息: