Android internet FAQ: I'm getting an internet access error with my Android application that says, "java.net.UnknownHostException: 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): java.net.UnknownHostException: Unable to resolve host "www.google.com": 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 the "ping" command.
You can find this Android internet permission syntax, and other AndroidManifest permission examples, at this url on the android.com website: AndroidManifest.xml example.