我遇到了一个问题,我的应用程序使用的是okhttp版本3.12.1 (https://github.com/square/okhttp),即使我已经在AndroidManifest.xml中提供了Internet权限,它也无法连接到域名。但是根据用户的评论,他们可以连接到设备上的互联网并使用其他应用程序。
目前,我无法重现这个异常,如果有人之前遇到过这个问题,希望能帮助我更好地理解。
由于我不想引入大的改变,因此我暂时不能升级库。
堆栈跟踪:
目前,我无法重现这个异常,如果有人之前遇到过这个问题,希望能帮助我更好地理解。
由于我不想引入大的改变,因此我暂时不能升级库。
堆栈跟踪:
Caused by: java.net.UnknownHostException: Unable to resolve host "domain.com": No address associated with hostname
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
at java.net.InetAddress.getAllByName(InetAddress.java:1152)
at okhttp3.Dns$-CC.lambda$static$0(SourceFile:39)
at okhttp3.-$$Lambda$Dns$mTkNcZf2K4euny3_jks6Cac6Az0.lookup(Unknown Source:0)
at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress(SourceFile:185)
at okhttp3.internal.connection.RouteSelector.nextProxy(SourceFile:149)
at okhttp3.internal.connection.RouteSelector.next(SourceFile:84)
at okhttp3.internal.connection.StreamAllocation.findConnection(SourceFile:214)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(SourceFile:135)
at okhttp3.internal.connection.StreamAllocation.newStream(SourceFile:114)
at okhttp3.internal.connection.ConnectInterceptor.intercept(SourceFile:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(SourceFile:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(SourceFile:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(SourceFile:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:121)
at com.appdynamics.eumagent.runtime.a.a$a.intercept(SourceFile:108)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:121)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(SourceFile:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(SourceFile:264)
at okhttp3.RealCall.execute(SourceFile:93)
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
at libcore.io.Linux.android_getaddrinfo(Native Method)
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:74)
at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:200)
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:74)
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
... 39 more
ping domain.com -6
会产生相同的错误。不确定您的用户是否需要IPv6地址... - greeble31