DEV Community

Max
Max

Posted on

ClientException with SocketException: Failed host lookup

hi, i put in my AndroidManifest.xml, but id i call my api android show this error:

ClientException with SocketException: Failed host lookup: 'xxx.www.it' (OS Error: No address associated with hostname, errno = 7)

any Help?
Br max

Top comments (3)

Collapse
 
dennistobar profile image
Dennis Tobar

Hi, welcome to dev.to :)

Seems to be a problem with DNS resolution about the hostname/domain. Double check if there is a misspelling or something relate with it. Some cases you need a proxy connection or to connect to other network to do request to a private resource/domain.

I don't know about programming in Android, but the problem "is universal"

Collapse
 
maxdiable profile image
Max

I did a test with a simple call to an api which returns true or false and if I launch the api in the browser "resettami-apex/api/test" it works while from the app it always gives me an error

Collapse
 
dennistobar profile image
Dennis Tobar

mmm.... if resettami-apex is mapped to localhost (127.0.0.1) or your docker.internal.host (ie: 172.0.0.1), the app can't find the address because is defined for your computer and not for the phone. Sometimes, when you are developing an app in your setup, you may need to access it by your IP address (ie: 192.168.0.2) and expose your API using your IP address.