CLEARTEXT communication to 124.93.196.45 not permitted by network security policy
請(qǐng)求框架搭建完,設(shè)置了BaseUrl開始訪問,結(jié)果CLEARTEXT communication to XX not permitted by network security policy
是我們的baseUrl因?yàn)槭莾?nèi)部測(cè)試環(huán)境所以使用的是ip地址,或者h(yuǎn)ttp://
原因:Android P系統(tǒng)限制了明文流量的網(wǎng)絡(luò)請(qǐng)求,之下的版本沒有影響,所以okhttp3會(huì)拋出該異常。
解決方案1:https://
解決方案2: 在AndroidManifest.xml配置文件中添加 android:usesCleartextTraffic="true"
