Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Concurrency and Error Handling Configuring the Alert Dialog

Unable to resolve host "api.forecast.io": No address associated with hostname

Hi all,

I've been following the course and everything was going fine until I noticed that the JSON data wasn't pulling through.

I've introduced some Log points in the my code to see where the issue is arising. It is failing in the public void onFailure part of the Callback class.

I've logged the error and get what's in the subject of this post. I have checked that the forecastUrl is correct and does go to the page of JSON data, so it isn't that.

The full logcat says, java.net.UnknownHostException: Unable to resolve host "api.forecast.io": No address associated with hostname.

Any thoughts?



4 Answers

Your network cannot resolve the hostname api.forecast.io. Are you connected to the internet?

This error is due to api.forecast.io not being able to be translated to an IP address via DNS.

Yes, I'm connected and can open the JSON in Chrome with no problem at all. DNS works just fine there.

I am having the same issue and I have tried everything to fix this. No luck so far.

el mismo problema, no muestra la información en en log si no solo el mensaje. Unable to resolve host "api.forecast.io": No address associated with hostname.

es en el onFailure del enqueue