Landen Landen -3 years ago 544
Android Question

Firebase Authentication FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host) has occurred

I'm creating an authentication workflow for my android app. I'm allowing users to sign in with username/password and various OAuth providers. I'm validating emails and password so that, I know the information I'm passing to Firebase is valid. I'm using

com.google.firebase:firebase-auth:9.6.1


When I execute the following code, I get a callback that says the operation not successful with an error.

mFirebaseAuth.signInWithEmailAndPassword(username,password).addOnCompleteListener(this);


Callback function or completion listener tells me

com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host) has occurred.


The username I'm passing doesn't exist yet. So, I would assume to see some kind of error stating the user doesn't exist. Am I passing something incorrectly or am I assuming incorrectly? I can also see that in the Firebase documentation, the iOS library has a various error codes common to all API methods section where as the Android section doesn't show this. One of these exceptions is
FIRAuthErrorCodeUserNotFound
. So, does that functionality even exists in the Android library?

Answer Source

It can also happen when google play services are not running. Try to launch play store and check if it is working. If not reboot of device issue.And also compare the google play services using in the project and google play services in the device are same if not update google play services.

This is just a minor but possible case where it gives the exception.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download