-1

I am developing an android application on Android L (5.0.1). I have internet permission in my manifest as follows:

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

I am receiving the following error: Unable to resolve host <url>: No address associated with hostname while running my application.

Restarting the Wifi on the phone while the application is open fixes the issue for that session. That means the URL is working fine. Doing this each time while testing the application is time consuming. This is also unacceptable in production.

Could not find any similar issues online. Any help would be greatly appreciated.

13
  • Check your website URL: Commented Apr 4, 2015 at 5:54
  • Hi. As mentioned in the question, on restarting the wifi when the application is open, I'm able to connect to the URL. Hence the URL should be working fine. Commented Apr 4, 2015 at 6:01
  • That means your device does not recognized WiFi after restart. Commented Apr 4, 2015 at 6:02
  • Disconnected applications throw same error. I was facing this yesterday, and argued with back end that url is invalid until realized (quite foolishly) that internet was disconnected. Commented Apr 4, 2015 at 6:03
  • @Kay Even when the application is throwing this error, other apps are able to connect to internet. Can a single application be disconnected even with internet permission? If so, whats could be the reason? Commented Apr 4, 2015 at 6:09

2 Answers 2

1

Make sure You have concerned over followings ,

  1. Always you are passing a valid url
  2. You have connected to stable internet source.
Sign up to request clarification or add additional context in comments.

2 Comments

Restarting WiFi fixes the issue. Hence this shouldn't be an issue with the URL. Also, the internet connection is pretty stable since I am not having any connectivity issues on other apps or on laptop.
I am facing the same issue. I have connection timeout and read timeout setup. Why is that it throws UnknowHostExcpetion and not SocketTimeoutException after the timeout period ?
0

Solved the issue by restarting my device.

Now my application is able to send request to the server without having to restart device wifi. Not sure what caused the issue though.

Thanks for the quick support guys. :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.