AndroidManifest里application里加个android:usesCleartextTraffic="true"
在Android8.0以后,系统默认支持https访问,如果需要访问http的话则要在AndroidManifest.xml中的application标签中进行一个网络安全配置,即配置程序允许http请求。在res下新建xml文件夹,xml文件夹下创建这个文件:
在application标签中配置:
android:networkSecurityConfig="@xml/network_security_config"
Google表示,为保证用户数据和设备的安全,针对下一代 Android 系统(Android P) 的应用程序,将要求默认使用加密连接,这意味着 Android P 将禁止 App 使用所有未加密的连接,因此运行 Android P 系统的安卓设备无论是接收或者发送流量,未来都不能明码传输。
Android P起默认无法使用http