Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OkHttp MockWebServer fails to accept connections in android P (API 28) Instrumentation Test

When I have updated my sdk version from API 26 to API 28, OKHttp mockserver fails to run in the device/emulator in my android instrumentation test. It ran perfectly in the older versions. I have checked in the Network Config

<network-security-config>
    <domain-config>
       <domain-config cleartextTrafficPermitted="true">
          <domain includeSubdomains="false">localhost</domain>
       <domain-config>
    </domain-config>
 </network-security-config>
like image 895
Prabhakaran Avatar asked Oct 28 '25 17:10

Prabhakaran


1 Answers

I figured out by changing the cleartext value in the base-config. May be it will useful to some one.

<network-security-config> 
   <base-config cleartextTrafficPermitted="true" /> 
</network-security-config>
like image 64
Prabhakaran Avatar answered Oct 31 '25 07:10

Prabhakaran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!