1

No address associated with hostname

but it work well in real device! can you meet the scene

foxundermon
  • 540
  • 7
  • 18

2 Answers2

1

Give internet permission in manifest file,

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

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

And also change your url into IP like,

www.google.com into 74.125.29.138

If you don`t know IP address use this link-http://freelabs.info/UrlToIpOnline.aspx

Ranjithkumar
  • 14,780
  • 10
  • 107
  • 140
0

Possible Dupicate of UnkownHostException

It also occur when you don't have the internet permission or internet/wifi not enabled.

Community
  • 1
  • 1
Ishtiaq
  • 1,176
  • 8
  • 18