error:CLEARTEXT communication to api.help.bj.cn not permitted by network security policy
生活随笔
收集整理的这篇文章主要介绍了
error:CLEARTEXT communication to api.help.bj.cn not permitted by network security policy
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
这个问题出现的原因是Android P系统限制了明文流量的网络请求
处理方法就是
1 首先需要在res 目录下创建一个xml 包然后在创建一个xml 如下图
里面的内容
<?xml version="1.0" encoding="utf-8"?>
<network-security-config><base-config cleartextTrafficPermitted="true" />
</network-security-config>
然后在Mainifest 里面 的application 里面引用
android:networkSecurityConfig="@xml/network_security_config"
如下图
这样就可以了
参考:https://blog.csdn.net/w180600/article/details/85230778
总结
以上是生活随笔为你收集整理的error:CLEARTEXT communication to api.help.bj.cn not permitted by network security policy的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: baseUrl must end in
- 下一篇: error:socket failed: