java.net.Unknown Service Exception: CLEARTEXT communication to 192.168.0.40 not permitted by network

这个是我第一次访问后台意思报的错误:中文意思是说  :未知服务异常:明文通信到192.168.0.40是网络安全策略不允许的

导致这样的原因是什么呢?  大家可以看下这问大神的解析https://www.jianshu.com/p/53eeb163b19a

解决方法:1、在app下的res文件下新建xml文件

network_security_config

java.net.Unknown Service Exception: CLEARTEXT communication to 192.168.0.40 not permitted by networkjava.net.Unknown Service Exception: CLEARTEXT communication to 192.168.0.40 not permitted by network

配置如下:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

2,在AndroidManifest文件的application标签节点中配置

android:networkSecurityConfig="@xml/network_security_config"

如下图:

java.net.Unknown Service Exception: CLEARTEXT communication to 192.168.0.40 not permitted by network

再次请求后台数据就OK了