Firebase isn't reporting crashes related to OkHttp

Related searches

I was migrating my code from Google analytics to Firebase, following problem I'm facing

  1. Some of the custom events show correct value while others not although code used are same in all cases. Can provide code if required.

Update : Above is solved, I was sending large data so its just omitted them.

  1. Prior to using OkHttp(using Android network library and Asynctask) firebase shows correct line number in crash reports but not after using OkHttp, I can confirm that I have uploaded correct mapping file as other non OKHttp related crashes are reported correctly.

So my concern is not exception but from where it is thrown?

Firebase crash report before OKhttp

Exception connect timed out ( ( ( ( ( ( ( ( ( ($1.connectAndSetOwner ( ( ( ( ( (
com.package.MyClass$4.doInBackground (
com.package.MyClass$4.doInBackground (
android.os.AsyncTask$ ( (
android.os.AsyncTask$SerialExecutor$ (
java.util.concurrent.ThreadPoolExecutor.runWorker (
java.util.concurrent.ThreadPoolExecutor$ ( (

Firebase crash report after OkHttp

Exception connect timed out ( ( ( ( ( (
okhttp3.internal.platform.AndroidPlatform.connectSocket (
okhttp3.internal.connection.RealConnection.connectSocket (
okhttp3.internal.connection.RealConnection.connect (
okhttp3.internal.connection.StreamAllocation.findConnection (
okhttp3.internal.connection.StreamAllocation.findHealthyConnection (
okhttp3.internal.connection.StreamAllocation.newStream (
okhttp3.internal.connection.ConnectInterceptor.intercept (
okhttp3.internal.http.RealInterceptorChain.proceed (
okhttp3.internal.http.RealInterceptorChain.proceed (
okhttp3.internal.cache.CacheInterceptor.intercept (
okhttp3.internal.http.RealInterceptorChain.proceed (
okhttp3.internal.http.RealInterceptorChain.proceed (
okhttp3.internal.http.BridgeInterceptor.intercept (
okhttp3.internal.http.RealInterceptorChain.proceed (
okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (
okhttp3.internal.http.RealInterceptorChain.proceed (
okhttp3.internal.http.RealInterceptorChain.proceed (
okhttp3.RealCall.getResponseWithInterceptorChain (
okhttp3.RealCall$AsyncCall.execute ( (
java.util.concurrent.ThreadPoolExecutor.runWorker (
java.util.concurrent.ThreadPoolExecutor$ ( (

As requested code for OkHttp implementation

Request request = new Request.Builder().url(Uri.parse(serviceUrl).buildUpon().appendPath("test").toString())

        client.newCall(request).enqueue(new Callback() {
            public void onFailure(@NonNull Call call, @NonNull IOException e) {

            public void onResponse(@NonNull Call call, @NonNull final Response response) throws IOException {

After initializing crashlytics in your base application with following code (Note this part is missing in Google's official documentation)


Call following function


In this way you, on your next application start, unsent reports will be uploaded

You can use this link for crashlytics integration

Understand Realtime Database Billing, Learn how to set up Firebase for web apps. Try it now. Firebase documentation. Documentation to help you understand key topics in Firebase development. Firebase is deeply integrated with Google Cloud Platform, allowing you to use Google's Infrastructure-as-a-Service directly within your Firebase project. See Pricing FAQ for more information.

To your OkHttpClient add :

client.connectTimeoutMillis(20000);  // 20000 means 20 seconds give time here in milliseconds

or you can also add it to your client builder as:

clientBuilder.connectTimeout(60, TimeUnit.SECONDS);

This happens because when response of server reached to you, your request timed out. Give timeout what you think is feasible for your server to respond.

or you can also may be do with that too but I am not sure about that:

Request request = new Request.Builder().wait(long millisecondshere).url(Uri.parse(serviceUrl).buildUpon().appendPath("test").toString())

Firebase | Google Developer Profile, Cloud Firestore is one of two Firebase tools that allows developers to set up and provision a back-end database as a service. Released in 2017,� Firebase Analytics is a Google-owned tool that attempts to analyze your app behavior so that you can make timely decisions and can grow your app to the next level. As you already know the market is full of analytics tools, but Google creates the best since it has the sole purpose of collecting data to earn money.

This is Timeout issue,

There are two possibilities,

  1. have you checked and tested your connection.
  2. better don't set any connection timeout,if you are setting chose maximum time, because it throws an error,if server didn't response within given time..

Preventing SocketTimeoutException is beyond our limit...One way to effectively handle it is to define a connection timeout and later handle it by using a try catch block.... hope this will help anyone in future who are facing the same issue.

You can set time out for HttpUrlConnection like,

HttpUrlConnection conn = (HttpURLConnection) url.openConnection();

Building a Real-World Web App With Vue.js & Firebase, Firebase is a serverless platform for unified development of applications for mobile devices and for the Web. It uses the NO-SQL structure as opposed to RDBMS� Firebase is Google’s mobile application development platform that encourages you to manufacture, improve, and become your application. As an organization (ChromeInfotech), bunches of customers are coming to us and asked about the best development platform for their software and the right wireframing for their mobile application.

Newest 'firebase' Questions, This is the first in a series of blog posts on Architecting your application with Firebase. Firebase isn't just any ordinary database. As a real-time,� i have the issue with firebase.util lib, as Rodrigo said i think is problem of the versión. Before: var ref = new Firebase('url'); Now: firebase.initializeApp(config); As the firebase object is defined differently it does not find it. In my case, I need to update the library to be compatible with version 3.0 of firebase.

Where does Firebase fit in your app?, If a user isn’t signed in with Google Play, it’s essential to sign in to enjoy the app that is an unlikely cause. Login with Google Using Firebase in Android Studio (Step by Step) Create a new project in Android Studio

Firebase This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10).

  • The stacktrace shows you started using OkHttp instead of Android's built-in version of OkHttp. What are you asking?
  • Android started using Okhttp internally starting from lollipop, as I have to support 4.0, I migrated to using Okhttp, as you can see in above logcat location of crash is mentioned as MyClass, but not in the latter version when I explicitly used OKhttp, I am asking the reason for this?
  • Please provide the sources for this. Before you were using an async task which is clear in the stacktrace. How is this call implemented now?
  • Updated the question with code although it just a simple call, my concern is not exception but from where it is thrown?
  • Thanks, but the question is location of crash is not provided when OkHttp is used