Dio_V
Dio_V

Reputation: 79

Retrofit got UnknownHostException calling url with '-' or '_' in it

I'm trying to call an api in my Android application. and the url template is like:

test--.domainname.com/api/xxxxxx

I'm using Retrofit2 but I got the follow Exception:
Unable to resolve host "test---.domainname.com": No address associated with hostname

I'm sure I can got the success response from the url using browser. And Retrofit2 works very well for other api without '-' or '_' in the path.

Is the exception a feature of okHttp or Retrofit? or just someone can help me with this problem?


I've read the 1552 issue of Retrofit. And I'm sure I add the correct scheme.

Upvotes: 0

Views: 413

Answers (1)

Harry T.
Harry T.

Reputation: 3527

test--.domainname.com/api/xxxxxx this subdomain is ended with symbol -, this is incorrect. So check your link first.

Upvotes: 1

Related Questions