Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP
记录一下Android p上访问http失败
Android P上全面禁止了非安全的http链接,如果要使用非加密连接,需要配置network security config。
步骤如下:
1、在res/xml下新建network security config文件,名字任意,可以叫做network_security_config.xml
<network-security-config&g...
学习第一行代码第二版第14章时,在第二阶段“完成遍历省市县三级列表的功能”时一直无法完成,报错android:usesCleartextTraffic 指示应用程序是否打算使用明文网络流量,例如明文HTTP。目标API级别为27或更低的应用程序的默认值为“ true”。面向API级别28或更高级别的应用默认为“ false”。
android:usesCleartextTraffic 指示应用程序是否打算使用明文网络流量,例如明文HTTP。目标API级别为27或更低的应用程序的默认值为“ true”。面向API级别28或更高级别的应用默认为“ false”。
当属性设置为“ false”时,平台组件(例如,HTTP和FTP堆栈,DownloadManager和MediaPlayer)将拒绝应用程序使用明文流量的...
在manifest 中application节点添加
android:usesCleartextTraffic=“true”
android:usesCleartextTraffic 指示应用程序是否打算使用明文网络流量,例如明文HTTP。目标API级别为27或更低的应用程序的默认值为“ true”。面向API级别28或更高级别的应用默认为“