概述
报错log:
03-07 15:34:38.645: W/System.err(8731): java.net.UnknownHostException: Unable to resolve host “images.liqucn.com”: No address associated with hostname
03-07 15:34:38.655: W/System.err(8731): at java.net.InetAddress.lookupHostByName(InetAddress.java:426)
03-07 15:34:38.655: W/System.err(8731): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
03-07 15:34:38.655: W/System.err(8731): at java.net.InetAddress.getAllByName(InetAddress.java:220)
03-07 15:34:38.655: W/System.err(8731): at libcore.net.http.HttpConnection.(HttpConnection.java:71)
03-07 15:34:38.655: W/System.err(8731): at libcore.net.http.HttpConnection.(HttpConnection.java:50)
03-07 15:34:38.655: W/System.err(8731): at libcore.net.http.HttpConnection
Address.connect(HttpConnection.java:351)03−0715:34:38.655:W/System.err(8731):atlibcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)03−0715:34:38.655:W/System.err(8731):atlibcore.net.http.HttpConnection.connect(HttpConnection.java:128)03−0715:34:38.665:W/System.err(8731):atlibcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)03−0715:34:38.665:W/System.err(8731):atlibcore.net.http.HttpEngine.connect(HttpEngine.java:303)03−0715:34:38.665:W/System.err(8731):atlibcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)03−0715:34:38.665:W/System.err(8731):atlibcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)03−0715:34:38.665:W/System.err(8731):atlibcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)03−0715:34:38.665:W/System.err(8731):atlibcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:479)03−0715:34:38.665:W/System.err(8731):atcom.example.duandianxuchuan.MainActivity
2.run(MainActivity.java:78)
03-07 15:34:38.665: W/System.err(8731): at java.lang.Thread.run(Thread.java:856)
03-07 15:34:38.680: W/System.err(8731): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
03-07 15:34:38.685: W/System.err(8731): at libcore.io.Posix.getaddrinfo(Native Method)
03-07 15:34:38.685: W/System.err(8731): at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
03-07 15:34:38.685: W/System.err(8731): at java.net.InetAddress.lookupHostByName(InetAddress.java:411)
03-07 15:34:38.685: W/System.err(8731): … 15 more
代码是:conn.getResponseCode()
在android开发的时候经常会遇到这个错误,一般来说,造成这种错误的最普遍情况有两种:
1.android设备网络连接没打开,例如3G网络和WIFI网络
所以,如果遇到这种错误时,请先查看网络是否已正常连接.
2.Manifest文件没有标明网络访问权限
如果确认网络已经正常连接并且还是出这种错误的话,那么请看下你的Manifest文件是否标明应用需要网络访问权限,如果没标明的话,也访问不了网络,也会造成这种情况的.
//网络访问权限
转载自:http://blog.csdn.net/w250shini11/article/details/8646859
最后
以上就是怡然水池为你收集整理的java.net.UnknownHostException: Unable to resolve host "images.liqucn.com": No address associated wit的全部内容,希望文章能够帮你解决java.net.UnknownHostException: Unable to resolve host "images.liqucn.com": No address associated wit所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复