4

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!

Apostolos
  • 10,033
  • 5
  • 24
  • 39
TestBest
  • 915
  • 5
  • 12
  • 22
  • can you post your code? without seeing your code it seems that the host cannot be reached, are you using something like "http://play.googleapis.com" or just "play.googleapis.com"? – Emmanuel Sep 03 '13 at 21:28
  • Do you have internet connectivity in the emulator in other places? Could not be the resolver isn't getting proper dns or nat isn't working. – Lucas Holt Sep 03 '13 at 21:54
  • The app is declared with internet connectivity allowed, and it runs fine on device but in emulator it does not run. – TestBest Sep 03 '13 at 22:09
  • I had the same issue and come to know **"There was some issue with DNS for that particular domain."** – swiftBoy Dec 03 '13 at 06:07

3 Answers3

9

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
3

Switch off the emulator's Wifi, and then switch it back on usually fixes such errors.

Babatunde Adeyemi
  • 14,360
  • 4
  • 34
  • 26
0

Are you using an emulator that has the Google image or just the stock android image? If so you need to change to one that utilises the google APIs before you can use GCM because the google image includes playstore APIs which is what GCM runs off (simplistic explanation but it will suffice.

When creating an image for emulator select an image that is based on google Apis eg:

enter image description here

James W
  • 410
  • 2
  • 10