0

In my Android application I use my Rest API, delivered via the cloudflare network (with active proxy). Very often the first connection to the okhttp API receives the following error:

Non-fatal Exception: java.net.UnknownHostException
Unable to resolve host "mydomain.com": No address associated with hostname

After the user retries one or more times, subsequent connections are successful. If there is some downtime with API requests, the error is likely to occur again.

I cannot understand what causes this problem. If it can depend on cloudflare or if there is a way to solve on the okhttp side.

do you have any ideas?

ghost
  • 19
  • 2
  • I have the same issue, I created a new question with more information about my specific case. https://stackoverflow.com/questions/72474481/unable-to-resolve-host-mydomain-com-no-address-associated-with-hostname – tengl Jun 02 '22 at 10:20

1 Answers1

0

Or you have no internet on the device

or you forgot to add

<uses-permission android:name="android.permission.INTERNET" />

permission in manifest.xml

@see this thread

Narek Hayrapetyan
  • 1,535
  • 13
  • 24