安卓9.0默认不允许http请求
我们可以在APPlocation里面加上 android:usesCleartextTraffic="true"
但是我的是https的连接,所以应该不是这个问题,后面我看了一下错误结果如下
java.net.SocketException: socket failed: EPERM
emm最后找了半天发现卸载软件后重新安装就没问题了。。。。。
这模拟器是真的坑!
参考文章
https://www.jianshu.com/p/289be7794e24
have a same problem, with volley, but this is my solution:
In Android Manifiest, in tag application add:
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
create in folder xml this file network_security_config.xml and write this:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
inside tag application add this tag:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>