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: