jsoup通过URL解析网页时报IOException异常,如何解决?

Life1412378121 发布于 2017/03/09 12:03
阅读 351
收藏 0

请求代码:

总结异常日志:

java.net.UnknownHostException: Unable to resolve host "daohang.qq.com": No address associated with hostname

 

Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)

具体异常日志:

03-09 11:38:40.239:

W/System.err(1265): java.net.UnknownHostException: Unable                             to resolve host "daohang.qq.com": No address associated with hostname
03-09 11:38:40.239:

W/System.err(1265):     at                       java.net.InetAddress.lookupHostByName(InetAddress.java:424)

03-09 11:38:40.239:

W/System.err(1265):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
03-09 11:38:40.239:

W/System.err(1265):     at java.net.InetAddress.getAllByName(InetAddress.java:214)

03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28)
03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122)

03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
03-09 11:38:40.239:

W/System.err(1265):     at com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161)
03-09 11:38:40.239:

W/System.err(1265):     at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:329)
03-09 11:38:40.239:

W/System.err(1265):     at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:132)
03-09 11:38:40.239:

W/System.err(1265):     at org.jsoup.helper.HttpConnection.get(HttpConnection.java:121)
03-09 11:38:40.239:

W/System.err(1265):     at com.mh.jsoup.MainActivity$1.run(MainActivity.java:32)
03-09 11:38:40.239:

W/System.err(1265):     at java.lang.Thread.run(Thread.java:841)
03-09 11:38:40.239:

W/System.err(1265):

Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
03-09 11:38:40.239:

W/System.err(1265):     at libcore.io.Posix.getaddrinfo(Native Method)
03-09 11:38:40.239:

W/System.err(1265):     at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61)
03-09 11:38:40.239:

W/System.err(1265):     at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
03-09 11:38:40.239:

W/System.err(1265):     ... 16 more

加载中
0
googlewell
googlewell
这个一看就知道,没连上互联网,或者应用没有添加访问互联网权限
0
L
Life1412378121

太谢谢了,我把模拟器的WIFI关了,其他数据可以直接请求下来的,就是这个不行,我快被自己蠢哭了。

0
L
Life1412378121

引用来自“googlewell”的评论

这个一看就知道,没连上互联网,或者应用没有添加访问互联网权限

谢谢,我把模拟器WIFI关了,快被蠢哭了。

返回顶部
顶部