在Android O 升 P (8.0升9.0)的时候,会报以下异常
HTTP FAILED: java.net.UnknownServiceException: CLEARTEXT communication to 192.xxx.x.x not permitted
因为 Android P 是默认禁止访问http的API的 所以想要跳过https的限制需要在AndroidManifest.xml
的Application中添加以下内容
<application
...
android:usesCleartextTraffic="true"
...
/>
没有添加前:
添加后: