Prabhakaran
Prabhakaran

Reputation: 1337

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>

Upvotes: 4

Views: 1352

Answers (1)

Prabhakaran
Prabhakaran

Reputation: 1337

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>

Upvotes: 3

Related Questions