java.net.UnknownHostException(Unable to resolve host "play.googleapis.com": No address associated with hostname)

TestBest picture TestBest · Sep 3, 2013 · Viewed 16.6k times · Source

Full error message is shown below. This occurs while running an app in an emulator that uses Urban Airship and Google Cloud Messaging. I do not see it on device.

java.net.UnknownHostException(Unable to resolve host "play.googleapis.com": No address associated with hostname)

BTW, UA Guys How Do you shut off UA? commenting out UA.takeoff() leads to null point exceptions! Way to go! Thats a way to end up on stackoverflow!

Answer

think-Android picture think-Android · Sep 4, 2013

Most common reason for UnknownHostException is missing Internet-Permission. Check your AndroidManifest.xml for
<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Update:
later comment says, internet connectivity is allowed and it works on device. So it's emulator issue. Possible solutions:

  • use IP instead of hostname (for a test)
  • re-create the AVD
  • check min-SDK seetings against AVD sdk version