使用Kotlin从服务器加载图像时发生SSL错误

时间:2019-07-05 12:40:00

标签: android tls1.2 android-glide

Am使用Koltin v1.3.40,尝试在低端设备上使用glide获取SSL异常从服务器加载图像。同时为低端设备实现TLS功能。从服务器上正确加载kotlin插件图像后删除。解决问题。

class com.bumptech.glide.load.engine.GlideException:
Failed to load resource There was 1 cause: 
javax.net.ssl.SSLHandshakeException(javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7d8e2a90: Failure in SSL library, usually a protocol error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:744 0x746ab7e8:0x00000000)) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE –

1 个答案:

答案 0 :(得分:0)

xml中创建一个res文件夹,然后创建network_security_config.xml

所以res/xml/network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true"/>
</network-security-config>

然后

转到manifests.xml并将此属性添加到<application

android:networkSecurityConfig="@xml/network_security_config"

参考:https://developer.android.com/training/articles/security-config