I've got an Android app which has been in production for some time. I've received a fatal report to Firebase (log is below) but it's not clear to me how to avoid it next time.
I've found similar stack trace here java.net.UnknownHostException Unable to resolve host "accounts.google.com": No address associated with hostname while inserting rows in bigquery but they were able resolved it with:
<uses-permission android:name="android.permission.INTERNET" />
But that's not my case.
For network communication I use:
- Retrofit 2
- okhttp 3
- rxjava2 adapter for Retrofit 2
With this settings all errors end up in onError function in rx subscribe. I handle UnknownHostException in all HTTP calls but even if I didn't it should report non-fatal as the worst case.
I don't know how to reproduce this bug. The stack trace is not very helpful as it doesn't point me anywhere to my application.
Any ideas on what to do to reproduce the bug and any other insights will be much apprechiated.
This is the stack trace:
Exception java.net.UnknownHostException: Unable to resolve host "rest.mywebsite.com": No address associated with hostname
java.net.InetAddress.lookupHostByName (InetAddress.java:470)
java.net.InetAddress.getAllByNameImpl (InetAddress.java:252)
java.net.InetAddress.getAllByName (InetAddress.java:215)
okhttp3.Dns$1.lookup (Dns.java)
okhttp3.internal.connection.RouteSelector.hasNext (RouteSelector.java)
<OR>.connectFailed (RouteSelector.java)
<OR>.resetNextProxy (RouteSelector.java)
<OR>.resetNextInetSocketAddress (RouteSelector.java)
<OR>.getHostString (RouteSelector.java)
okhttp3.internal.connection.RouteSelector.nextProxy (RouteSelector.java)
okhttp3.internal.connection.RouteSelector.next (RouteSelector.java)
okhttp3.internal.connection.StreamAllocation.newStream (StreamAllocation.java)
<OR>.findHealthyConnection (StreamAllocation.java)
<OR>.findConnection (StreamAllocation.java)
<OR>.streamFinished (StreamAllocation.java)
<OR>.codec (StreamAllocation.java)
<OR>.deallocate (StreamAllocation.java)
<OR>.streamFailed (StreamAllocation.java)
<OR>.acquire (StreamAllocation.java)
okhttp3.internal.connection.StreamAllocation.newStream (StreamAllocation.java)
<OR>.findHealthyConnection (StreamAllocation.java)
<OR>.findConnection (StreamAllocation.java)
<OR>.streamFinished (StreamAllocation.java)
<OR>.codec (StreamAllocation.java)
<OR>.deallocate (StreamAllocation.java)
<OR>.streamFailed (StreamAllocation.java)
<OR>.acquire (StreamAllocation.java)
okhttp3.internal.connection.StreamAllocation.newStream (StreamAllocation.java)
<OR>.findHealthyConnection (StreamAllocation.java)
<OR>.findConnection (StreamAllocation.java)
<OR>.streamFinished (StreamAllocation.java)
<OR>.codec (StreamAllocation.java)
<OR>.deallocate (StreamAllocation.java)
<OR>.streamFailed (StreamAllocation.java)
<OR>.acquire (StreamAllocation.java)
okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.java)
<OR>.stripBody (CacheInterceptor.java)
<OR>.maybeCache (CacheInterceptor.java)
<OR>.cacheWritingResponse (CacheInterceptor.java)
<OR>.combine (CacheInterceptor.java)
<OR>.isEndToEnd (CacheInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.java)
<OR>.cookieHeader (BridgeInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RetryAndFollowUpInterceptor.cancel (RetryAndFollowUpInterceptor.java)
<OR>.setCallStackTrace (RetryAndFollowUpInterceptor.java)
<OR>.intercept (RetryAndFollowUpInterceptor.java)
<OR>.createAddress (RetryAndFollowUpInterceptor.java)
<OR>.recover (RetryAndFollowUpInterceptor.java)
<OR>.isRecoverable (RetryAndFollowUpInterceptor.java)
<OR>.followUpRequest (RetryAndFollowUpInterceptor.java)
<OR>.sameConnection (RetryAndFollowUpInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.logging.HttpLoggingInterceptor.setLevel (HttpLoggingInterceptor.java)
<OR>.intercept (HttpLoggingInterceptor.java)
<OR>.isPlaintext (HttpLoggingInterceptor.java)
<OR>.bodyEncoded (HttpLoggingInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.RealCall.getResponseWithInterceptorChain (RealCall.java)
okhttp3.RealCall$AsyncCall.execute (RealCall.java)
okhttp3.internal.NamedRunnable.run (NamedRunnable.java)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588)
java.lang.Thread.run (Thread.java:818)
Caused by android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
libcore.io.Posix.android_getaddrinfo (Posix.java)
libcore.io.ForwardingOs.android_getaddrinfo (ForwardingOs.java:55)
java.net.InetAddress.lookupHostByName (InetAddress.java:451)
java.net.InetAddress.getAllByNameImpl (InetAddress.java:252)
java.net.InetAddress.getAllByName (InetAddress.java:215)
okhttp3.Dns$1.lookup (Dns.java)
okhttp3.internal.connection.RouteSelector.hasNext (RouteSelector.java)
<OR>.connectFailed (RouteSelector.java)
<OR>.resetNextProxy (RouteSelector.java)
<OR>.resetNextInetSocketAddress (RouteSelector.java)
<OR>.getHostString (RouteSelector.java)
okhttp3.internal.connection.RouteSelector.nextProxy (RouteSelector.java)
okhttp3.internal.connection.RouteSelector.next (RouteSelector.java)
okhttp3.internal.connection.StreamAllocation.newStream (StreamAllocation.java)
<OR>.findHealthyConnection (StreamAllocation.java)
<OR>.findConnection (StreamAllocation.java)
<OR>.streamFinished (StreamAllocation.java)
<OR>.codec (StreamAllocation.java)
<OR>.deallocate (StreamAllocation.java)
<OR>.streamFailed (StreamAllocation.java)
<OR>.acquire (StreamAllocation.java)
okhttp3.internal.connection.StreamAllocation.newStream (StreamAllocation.java)
<OR>.findHealthyConnection (StreamAllocation.java)
<OR>.findConnection (StreamAllocation.java)
<OR>.streamFinished (StreamAllocation.java)
<OR>.codec (StreamAllocation.java)
<OR>.deallocate (StreamAllocation.java)
<OR>.streamFailed (StreamAllocation.java)
<OR>.acquire (StreamAllocation.java)
okhttp3.internal.connection.StreamAllocation.newStream (StreamAllocation.java)
<OR>.findHealthyConnection (StreamAllocation.java)
<OR>.findConnection (StreamAllocation.java)
<OR>.streamFinished (StreamAllocation.java)
<OR>.codec (StreamAllocation.java)
<OR>.deallocate (StreamAllocation.java)
<OR>.streamFailed (StreamAllocation.java)
<OR>.acquire (StreamAllocation.java)
okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.java)
<OR>.stripBody (CacheInterceptor.java)
<OR>.maybeCache (CacheInterceptor.java)
<OR>.cacheWritingResponse (CacheInterceptor.java)
<OR>.combine (CacheInterceptor.java)
<OR>.isEndToEnd (CacheInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.java)
<OR>.cookieHeader (BridgeInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RetryAndFollowUpInterceptor.cancel (RetryAndFollowUpInterceptor.java)
<OR>.setCallStackTrace (RetryAndFollowUpInterceptor.java)
<OR>.intercept (RetryAndFollowUpInterceptor.java)
<OR>.createAddress (RetryAndFollowUpInterceptor.java)
<OR>.recover (RetryAndFollowUpInterceptor.java)
<OR>.isRecoverable (RetryAndFollowUpInterceptor.java)
<OR>.followUpRequest (RetryAndFollowUpInterceptor.java)
<OR>.sameConnection (RetryAndFollowUpInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.logging.HttpLoggingInterceptor.setLevel (HttpLoggingInterceptor.java)
<OR>.intercept (HttpLoggingInterceptor.java)
<OR>.isPlaintext (HttpLoggingInterceptor.java)
<OR>.bodyEncoded (HttpLoggingInterceptor.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.internal.http.RealInterceptorChain.request (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.proceed (RealInterceptorChain.java)
<OR>.sameConnection (RealInterceptorChain.java)
okhttp3.RealCall.getResponseWithInterceptorChain (RealCall.java)
okhttp3.RealCall$AsyncCall.execute (RealCall.java)
okhttp3.internal.NamedRunnable.run (NamedRunnable.java)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588)
java.lang.Thread.run (Thread.java:818)
The phone was disconnected from network and it happend on Android 6.0.1.