- Android Studio version: 3.6.3
- Firebase Component: Auth
- Component version: 19.4.0
I've an android app in production with over 500k downloads on google play and some users (i dont know exactly why) have this error when logging in...
com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host)
at com.tomatedigital.giveawaymaster.task.LoginTask.lambda$firebaseAuth$1(LoginTask.java:249)
at com.tomatedigital.giveawaymaster.task.-$$Lambda$LoginTask$p6eSSF8vZ2BATwhlFttcJl8qT-w.onComplete(-.java)
at com.google.android.gms.tasks.zzi.run(zzi.java:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
there is no an easy correlation between these users, different android versions, different phone models....
i found this old issue: https://github.com/firebase/firebase-android-sdk/issues/384 but seems that someone in firebase team just trew it under the carpet instead of solving it (very common there)
the error is happening in real devices in production, I've a small chat embebed in the app and some users with problem come to support, ive asked to reinstall the app but they keep error... also it is not an INTERNET CONNECTION problem because people are talking to me in an online chat and having the problem in the same time
crashlytics show it is happening in 1% of sessions...
Relevant Code:
FirebaseAuth.getInstance().signInWithCustomToken(token).addOnCompleteListener(AsyncTask.THREAD_POOL_EXECUTOR, task -> {
if (task.isSuccessful()) {
FirebaseCrashlytics.getInstance().log("new firebase token successfully authenticated");
} else {
App.shouldNeverHappen(new RuntimeException(task.getException().getMessage() + " data: " + sb.toString()));
this.exception = task.getException();
}
});
//token is generated in my Firebase cloud functions as
auth.createCustomToken(uid).then(function(customToken) {
res.status(200).send(customToken);
}).catch(function(error) {
console.error("Error creating custom token:" + JSON.stringify(error));
res.status(200).json({
e: error
});
});