0

I tried to release an APK that is using Firebase Phone Auth on Google Play Store. Everything works just fine on DEBUG and PROFILE mode. But when I put it on RELEASE mode on play store here comes the problem:

Figure 1

What you see above is the log generated by my APK showing that it fails immediately when method verifyPhoneNumber() called. It only gives message [firebase_auth/null] null without any further explanation.

I already tried all answer in the following threads:

And unfortunately none of those solve my problem.

For your information, here's my flutter doctor and part of pubspec yaml.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-US)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[!] Android Studio (version 4.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.53.2)
[✓] Connected device (2 available)

pubspec.yaml

  firebase_core: ^0.5.3
  firebase_auth: ^0.18.4+1
  firebase_analytics: ^6.3.0
  firebase_messaging: ^7.0.3

Please masters help me! Thank you.

Adrian
  • 434
  • 6
  • 16

1 Answers1

0

Ok after a week of trying to figure this out, I finally got the solution.

In a brief conclusion: IT IS ABOUT THE SHA-1 FINGERPRINT.

Here's the solution:

  1. So I got the SHA-1 fingerprint from the Google Play Console (Select your app >> Release >> Setup >> App Integrity | App signing key certificate).

  2. Copy this SHA-1 fingerprint to your Firebase Project (Project Settings >> General | Your apps | SHA certificate fingerprints | Add fingerprints).

  3. Go to the Google Cloud Platform >> API & Services >> Credentials >> API Keys. In my case, I restrict my API key for this specific app, thus I set the package ID and SHA-1 fingerprint. This what makes the [firebase_auth null] null happen. I forgot to put the SHA-1 fingerprint from step 1 for the restriction as well. When I added it, everything solved.

That is all, and voila.. my app works like a charm! Hope this helps you if you get in here by a chance. Don't forget to vote up! :)

Cheers!

Adrian
  • 434
  • 6
  • 16