适配Android10时 networkSecurityConfig 编译报错

时间:2024-04-11 17:30:26

error: No resource identifier found for attribute 'networkSecurityConfig' in package 'android'

 

维护项目适配Android10时,提示网络请求错误

error:CLEARTEXT communication to xxx not permitted by network security policy

manifest文件中的application添加:android:networkSecurityConfig="@xml/network_config" 编译一直报错,

添加如下忽略依然不行,

tools:ignore="UnusedAttribute"
tools:replace="android:networkSecurityConfig"

修改Android10 sdk后正常(原项目默认变成了23了)

适配Android10时 networkSecurityConfig 编译报错