异常信息
System.err cn.itmob.sample W java.net.UnknownHostException: Unable to resolve host "api.doc.itmob.cn": No address associated with hostname
System.err cn.itmob.sample W at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
System.err cn.itmob.sample W at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
System.err cn.itmob.sample W at java.net.InetAddress.getAllByName(InetAddress.java:1152)
System.err cn.itmob.sample W at I7.s.a(SourceFile:6)
System.err cn.itmob.sample W at M7.e.a(SourceFile:416)
System.err cn.itmob.sample W at M7.a.intercept(SourceFile:60)
System.err cn.itmob.sample W at N7.f.b(SourceFile:122)
System.err cn.itmob.sample W at K7.b.intercept(SourceFile:946)
System.err cn.itmob.sample W at N7.f.b(SourceFile:122)
System.err cn.itmob.sample W at N7.a.intercept(SourceFile:144)
System.err cn.itmob.sample W at N7.f.b(SourceFile:122)
System.err cn.itmob.sample W at N7.g.intercept(SourceFile:146)
System.err cn.itmob.sample W at N7.f.b(SourceFile:122)
System.err cn.itmob.sample W at V7.a.intercept(SourceFile:555)
System.err cn.itmob.sample W at N7.f.b(SourceFile:122)
System.err cn.itmob.sample W at M7.i.h(SourceFile:100)
System.err cn.itmob.sample W at M7.f.run(SourceFile:48)
System.err cn.itmob.sample W at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
System.err cn.itmob.sample W at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
System.err cn.itmob.sample W at java.lang.Thread.run(Thread.java:1012)
System.err cn.itmob.sample W Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
System.err cn.itmob.sample W at libcore.io.Linux.android_getaddrinfo(Native Method)
System.err cn.itmob.sample W at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
System.err cn.itmob.sample W at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:222)
System.err cn.itmob.sample W at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
System.err cn.itmob.sample W at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
System.err cn.itmob.sample W ... 19 more
原因
可能引起该异常的两种原因:
1. 没有声明访问网络的权限
<uses-permission android:name="android.permission.INTERNET" />
2. 设备网络连接不可用
检查设备的网络连接,确保网络连接可用。