1.
Android CLEARTEXT communication to www.baidu.com not permitted by network security policy
报错原因:
Android P限制了非加密的流量请求导致出现 not permitted by network security policy
如何解决:
1.把所有的http请求全部改为https请求
2.在res的xml目录(),然后创建一个名为:network_config.xml文件,具体内容网上都有
3.在manifest的application标签中添加 android:usesCleartextTraffic=“true”
RxJava+RxAndroid+Retrofit+OkHttp网络请求
Android P系统由于加强了网络安全性,禁止了明文HTTP通信,导致出现'AndroidCLEARTEXTcommunicationtowww.baidu.comnotpermittedbynetworksecuritypolicy'的错误。为解决此问题,可以将所有网络请求切换到HTTPS,或者在res/xml目录下创建network_config.xml文件,并在manifest的application标签中添加android:usesCleartextTraffic=“true”。此方法允许应用使用非加密流量。
256

被折叠的 条评论
为什么被折叠?



