腾讯Bugly日志不上报的问题

2020-05-20  本文已影响0人  狂奔的_土豆

集成Bugly出现日志不上报的问题,通过查看日志发现是报错了:

ava.io.IOException: Cleartext HTTP traffic to android.bugly.qq.com not permitted

经查资料发现:Bugly官方文档上最高是适配的8.x,刚开始的时候我拿Android P进行测试也是无效果.后来发现log中有一句Cleartext HTTP traffic to android.bugly.qq.com not permitted. 拿起就是一阵Google,发现原来是Android P需要进行适配(限制了明文流量的网络请求,非加密的流量请求都会被系统禁止掉)。

解决办法:
1.在资源文件新建xml目录,新建文件:network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">android.bugly.qq.com</domain>
    </domain-config>
</network-security-config>

2.然后在清单文件中application下加入

android:networkSecurityConfig="@xml/network_security_config"
上一篇 下一篇

猜你喜欢

热点阅读