Android internet access error - Unable to resolve host

Android FAQ: “Help, I'm getting an internet access error with my Android application that says, " Unable to resolve host (hostname): No address associated with hostname". I think my HTTP/REST code is correct, what's wrong?”

If you get an error message like this:

03-25 14:26:02.750: W/System.err(13661): Unable to resolve host "": 
No address associated with hostname

while trying to access an internet resource, you may just need to correct permission in your Android manifest file (AndroidManifest.xml).

If you haven't already done so, add this line to your AndroidManifest.xml file, just after the <manifest> tag and before the <application> tag:

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

I think that's the most common cause of this UnknownHostException error message. Another possible cause is that your internet connection is actually down, and you can test that with your operating system’s "ping" command.

You can find this Android internet permission syntax, and other AndroidManifest permission examples, at this url on the website: AndroidManifest.xml example.