i am working with Retrofit library on my project, but it seems that Retrofit block non https requests.
I tried by adding in the application
tag in Manifest.xml
android:usesCleartextTraffic="true"
but didn't work, i also tried another solution by adding under res/xml
a security confing file:
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">http://my subdomain/</domain>
</domain-config>
</network-security-config>
and link it in application
tag in the Manifest.xml :
android:networkSecurityConfig="@xml/network_security_config"
both of the solution didn't work.
how can i avoid this error ?
NB: my code works fine when i test with https
request, and for testing purposes we are working in a subdomain which use http
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…