title: FirebaseRemoteConfigClientException on production (Android)
body: <p><strong>What have I done so far...</strong></p>
  <p>I am using <code>Tasks.await</code> <a href="https://developers.google.com/android/guides/tasks#blocking" rel="nofollow noreferrer">blocking</a> mechanism for firebase calls in worker threads for avoiding callbacks.</p>
  <p>I am using a worker thread (JobIntentService) for some initialization progress. JobIntentService starts when app opens and runs only once. below is my worker thread code</p>
  <pre><code>    if (isDeviceConnectedToInternet()) {
          Tasks.await(FirebaseConfigHelper.getRemoteConfig().fetchAndActivate()); //error here
          initFirebaseConfigVariables();
          // other codes
      }
  
  //FirebaseConfigHelper.java
  public static FirebaseRemoteConfig getRemoteConfig() {
      FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
      mFirebaseRemoteConfig.setDefaultsAsync(R.xml.remote_config_defaults);
      return mFirebaseRemoteConfig;
  }
  </code></pre>
  <p>I am using</p>
  <pre><code>implementation 'com.google.firebase:firebase-config:19.0.4'
  </code></pre>
  <p><strong>About the error</strong></p>
  <p>It is working fine in testing devices. I tested in another 15 Devices in <a href="https://firebase.google.com/docs/test-lab" rel="nofollow noreferrer">Firebase Test Lab</a>. There was no issues at all. but when I released to production this error occurred in some specific Mi and Samsung devices.</p>
  <p><strong>Error log</strong></p>
  <p>I was able to get only this log, because error happens in production</p>
  <pre><code>java.util.concurrent.ExecutionException:
  com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException:
  The client had an error while calling the backend!  at
  com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)   at
  com.google.android.gms.tasks.Tasks.await(Unknown Source:23) at
  com.maju.myapp.service.SyncWithFirebaseJobIntentService.syncWithFirebaseConfig(SyncWithFirebaseJobIntentService.java:207)   at
  com.maju.myapp.service.SyncWithFirebaseJobIntentService.onHandleWork(SyncWithFirebaseJobIntentService.java:55)  at
  androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392)   at
  androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383)   at
  android.os.AsyncTask$3.call(AsyncTask.java:378) at
  java.util.concurrent.FutureTask.run(FutureTask.java:266)    at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at
  java.lang.Thread.run(Thread.java:919)Caused by:
  com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException:
  The client had an error while calling the backend!  at
  com.google.firebase.remoteconfig.internal.ConfigFetchHttpClient.fetch(com.google.firebase:firebase-config@@19.0.4:194)  at
  com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackend(com.google.firebase:firebase-config@@19.0.4:278)  at
  com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackendAndCacheResponse(com.google.firebase:firebase-config@@19.0.4:251)  at
  com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchIfCacheExpiredAndNotThrottled(com.google.firebase:firebase-config@@19.0.4:191)    at
  com.google.firebase.remoteconfig.internal.ConfigFetchHandler.lambda$fetch$0(com.google.firebase:firebase-config@@19.0.4:160)    at
  com.google.firebase.remoteconfig.internal.ConfigFetchHandler$$Lambda$1.then(Unknown
  Source:4)   at com.google.android.gms.tasks.zzf.run(Unknown
  Source:2)   ... 3 moreCaused by: java.net.ConnectException: Failed to
  connect to
  firebaseremoteconfig.googleapis.com/2404:6800:4007:809::200a:443    at
  com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:147)    at
  com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)  at
  com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186) at
  com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)  at
  com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)   at
  com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)    at
  com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)    at
  com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)   at
  com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)   at
  com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:262)   at
  com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:219) at
  com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:30)  at
  com.google.firebase.remoteconfig.internal.ConfigFetchHttpClient.setFetchRequestBody(com.google.firebase:firebase-config@@19.0.4:321)    at
  com.google.firebase.remoteconfig.internal.ConfigFetchHttpClient.fetch(com.google.firebase:firebase-config@@19.0.4:182)  ...
  9 more
  </code></pre>
  <ol>
  <li>Why this is happening?</li>
  <li>How to avoid it?</li>
  </ol>
  <p>(Callbacks are making code ugly and messy, for making clean code I prefer Tasks.await)</p>