Android信版本-----Android9.0

一、Android err_cleartext_not_permitted

由于 Android P 限制了明文流量的网络请求,非加密的流量请求都会被系统禁止掉。
解决方案参考这个
https://blog.csdn.net/qq_18620851/article/details/80617549
https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted

方案一:

在Application里加上 android:usesCleartextTraffic="true"

方案二:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">Your URL(ex: 127.0.0.1)</domain>
    </domain-config>
</network-security-config>

AndroidManifest.xml -
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config"
        ...>
        ...
    </application>
</manifest>

二、ERR_EMPTY_RESPONSE

在打开网页的时候,会出现加载失败;网络没问题;android的原生请求能通;webview中打开的所有页面都会白屏;日志中的报错信息是:ERR_EMPTY_RESPONSE。

修正方法
https证书比较新,该vivo没有信任它的CA,换了一个正常点的CA就没问题了。
绕过方法
不用https,把https请求换成http
在网页上下载目标网址的CA证书,在手机上的“安全->受信凭据”中增加该证书

baidu了半天也没半点有用信息,这种兼容性的问题靠开发自己想真的很难。

猜你喜欢

转载自blog.csdn.net/pangjl1982/article/details/85336041