Firebase authentication network error on android

I am trying to run ionic 2 project with firebase on android emulator and android device. in both cases I am getting this error:
A network error (such as timeout, interrupted connection or unreachable host) has occurred."}

Do I have to do the following in firebase: “Add Firebase to your Android App”?
If yes than it is generating google.service.json file, what do I do with it?
It also requires to ass some lines in gradel file which I don’t have in ionic project.

Do I need it?
Anyone has idea how to get over this network problem?
Everything works fine with chrom web app.

I was able to fix it finally, The answer is the whitelist. I had to run the following commands:
cordova plugin add cordova-plugin-whitelist
cordova prepare

Thanks anyway :slight_smile:


Thank you! I ran into the same issue and the solution you provided works for me.

I have this error too but haven’t been able to fix it! Is there something you did to fix this that I’m missing? Thanks!

The error occurs on on all android devices. However, the app works fine on android when running locally: ionic run android

Firebase database calls work okay. It’s Firebase auth that’s producing the error.

cordova-plugin-whitelist is installed and was installed by default when creating new Ionic project.
Running cordova prepare didn’t seem to do anything any there was no information returned on the command prompt.

config.xml contains:

<plugin name="cordova-plugin-whitelist" spec="1.3.1" />
<access origin="*" />

index.html contains:

<meta http-equiv="Content-Security-Policy" content="font-src * data:; img-src * data:; default-src * 'unsafe-eval' 'unsafe-inline'">

Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
OS: Windows 8.1
Node Version: v7.2.1

1 Like

I’ve found a work around and have documented it on stackoverflow:

I can’t install cordova-plugin-whitelist, said that no eixst :frowning: I think that the problem is the version. Do u hace any idea?


Run command…ionic cordova plugin-add cordova-plugin-whitelist.
This would install whitelist plugin and then hat error can be resolved.

I know how install the plugin, the problem is when install the plugin

Solved. Deletes from folder plugins and re-add

how does this solve the problem .