12

I am building an app with Firebase Authentication and Realtime Database. Before yesterday, it was working cool in my device while testing. But I am not able to even login with Firebase now, but the app is working on other devices of my friends.

What is the actual issue here ? Is there any limitation for testing app your own real device? Is some kind of limitation exceeded ?

I tried uninstalling the app and reinstalling, removing user account from firebase database. But still no work.

Thanks!!

Roshan Gautam
  • 480
  • 1
  • 5
  • 15
  • 1
    Did you check the firebase console? – Joaquin Iurchuk Jul 05 '16 at 03:18
  • 2
    Yes, authenticated users credentials are added there, even mine. But they can pass the login screen and interact things, but not me.(not my device). @joaquin – Roshan Gautam Jul 05 '16 at 03:20
  • Check out the Firebase User Rules. Alter that if that gives you a false value – gsthina Jul 05 '16 at 06:39
  • It's true for both. – Roshan Gautam Jul 05 '16 at 07:43
  • Does the logcat shows any error? – Devid Farinelli Jul 05 '16 at 07:54
  • 4
    I have the same problem, @RoshanGautam have you find a solution? – Nicola Chiari Mar 05 '17 at 13:18
  • 1
    @hulon https://stackoverflow.com/questions/42755335/firebase-on-android-suddenly-not-working/49681029#49681029 – Deem Apr 05 '18 at 20:32
  • I too experience this problem. It happens when I switch between the emulator and the phone. It will work fine on the emulator, then I decide to switch to my test phone and I get no data back from the firebase db, even though authentication worked fine, my db rules are fine etc. It takes about an hour, after a series of uninstalling and installing the app again on the phone, then all of a sudden it will work, until the next time I switch to the emulator and then back to phone. Would really love to know whats going on! – TinaFrieda Nov 23 '18 at 22:30
  • 1
    Update on my comment. Finally figured out it was because of my login / logout logic. I wasn't actually logging out properly and so probably had multiple session going on. – TinaFrieda Nov 25 '18 at 13:42
  • In my case I disabled IPv6 in my router. – malhobayyeb Feb 24 '22 at 23:08

2 Answers2

3

In my case, it would work on an emulator but not on my actual device. The solution was resetting my WiFi router. I don't know why it worked but it did. This answer helped me: Firebase database listeners don't work on android with wifi

Adam Zarn
  • 1,868
  • 1
  • 16
  • 42
1

I faced the same issue and found the solution.

The Google Sign in works fine on emulators or on connected test devices but not on actual devices that downloads the your firebase app from google play store. This is because the apk file generated by your android studio is signed by default debug certificate fingerprint where as the application you publish on google play store is signed by different certificate finger print.

Both the certificate finger print should be whitelisted in firebase console otherwise the google sign in will not authenticate the user.

So to resolve this issue follow two steps.

  1. Generate the release certificate fingerprint with following command on MAC

    MAC: keytool -exportcert -list -v \ -alias your-key-name -keystore path-to-production-keystore

you will get output like following :

keytool -exportcert -list -v \ -alias aliasName -keystore /pathToKeystore/keyStore.jks Enter keystore password: Creation date: 27 May, 2017 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate fingerprints: MD5: 11:D0:F1:F6:26:F3:44:77:88 SHA1: D6:44:55:66:77:88:99:55:HH:AC:DB:17:8A

Where SHA1: is your fingerprint key, copy it.

For more info on how to generate fingerprint on MAC/WINDOWS visit https://developers.google.com/android/guides/client-auth

  1. Paste above SHA1 key to your firebase "Project Settings" and save. Google sign in should work fine now.

To read more on how this works visit https://developer.android.com/studio/publish/app-signing.html

Mayank
  • 43
  • 1
  • 8