I'm working on iPhone 12 Pro Max Emulator, macOS Catalina.
I'm getting this error when I try to run the app:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized.
Also there is a tip in the console:
Usually this means you've attempted to use a Firebase service before calling Firebase.initializeApp.
I initialize the Firebase before use it. Like this:
void main() async {
print('-- main');
WidgetsFlutterBinding.ensureInitialized();
print('-- WidgetsFlutterBinding.ensureInitialized');
await Firebase.initializeApp();
print('-- main: Firebase.initializeApp');
runApp(const MyApp());
}
This is what I see in the console output:
Xcode build done. 132.9s
flutter: -- main
flutter: -- WidgetsFlutterBinding.ensureInitialized
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized.
Usually this means you've attempted to use a Firebase service before calling `Firebase.initializeApp`.
I can't see the -- main: Firebase.initializeApp line in the console. So it fails in first trying to initialize the Firebase.
I create Android/Apple apps in Firebase. Downloaded google-services.json / GoogleService-Info.plist and put in the project.
GoogleService-Info.plist:
google-services.json:
I'm not using the android, but I added dependency into build.gradle: classpath 'com.google.gms:google-services:4.3.10'
And app/build.gradle: apply plugin: 'com.google.gms.google-services'
dependencies:
firebase_auth: ^3.3.5
firebase_messaging: ^10.0.9
google_sign_in: ^5.2.1
flutter --version:
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (3 months ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4
How can I solve this problem? BTW, I'm working on a brand new flutter project.
When you add google-services.json to an iOS project, you need to add it using Xcode as described in the following document:
https://firebase.flutter.dev/docs/manual-installation/ios
If you read through the page, you'll find the following note:
adding [google-service.json] manually via the filesystem won't link the file to the project
You need to try that then restart your app (rebuild it).
Edit: Additional Note:
You'll also need to add firebase_core to your dependencies in pubspec.yaml.
You have to add the GoogleService-Info.plist in Xcode instead of just placing it into the folder:
So it looks like this:
Note: The file can also be moved to a sub folder in the project (i.e. Runner).
Source: https://www.kindacode.com/article/flutter-correctly-adding-googleservices-info-plist-to-ios/
Here's how I fixed this error:
Ensure that all firebase services have been added to your pubspec.yaml file, in the dependencies section. firebase_core appears to be missing and is required to connect your flutter app to your firebase project.
You can simply add it using this command:
flutter pub add firebase_core
Add the firebase plugins to your main file:
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
Replace your void main function with an asynchronous one:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const YourAppGoesHere());
}
When I add the GoogleService-Info.plist file in Xcode, I used the wrong name GoogleService-Info**(1)**.plist.
If you have the same file in downloads, mac adds a number of copy to the next downloaded file.
Ok so I run my program without importing firebase core, firebase auth and cloud firestore, and my code runs just fine but I register my app with firebase and it still runs fine but as soon as I import Firebase_auth, Firebase_core and cloud_Firestore... I get the following error
Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Cannot fit requested classes in a single dex file (# methods: 89543 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Please help me.
I was having the same problem today and I found the solution here on Github
First, get the latest versions of your dependencies from pub.dev
Current latest versions are these:
firebase_auth: ^0.20.0+1
firebase_core: ^0.7.0
Then run these 3 commands in the terminal:
$ flutter pub upgrade
$ flutter pub get
$ flutter clean
And then run your project
$ flutter run
This will hopefully help you.
Seems it is a bug in Firebase plugins: https://github.com/FirebaseExtended/flutterfire/issues/3876. However setting min SDK to 23 does not show the warning.
it worked for me to change my sdkVersion to 23:
just go to android>app>build.gradle and
change the minSdkVersion-line in defaultConfig{} to .. minSdkVersion 23
$ flutter pub get
Just Do it in your Terminal it will work
Enable multidex in android project & run again.
I am suggesting this according to the last part of the error message you've posted.
According to this guide: https://firebase.flutter.dev/docs/installation/android#enabling-multidex
However, if your minSdkVersion is set to 20 or lower, then you must use the multidex support library and make the following modifications to your app project
In android - app - build.gradel file
add - implementation 'com.android.support:multidex:1.0.3' in dependencies section
add - multiDexEnabled true in default config section enter image description here
enter image description here
Suffered the error of FlutterFirebaseCorePlugin.java uses or overrides a deprecated API. for two days.
finally solved it by changing minSdkVersion to 21 in app/build.gradle and run the app with flutter run --no-sound-null-safety.
Found that the error comes from the sound null safety implementation which grey lists all incompatible API
There are two issues here, -Xlint and multidex.
For -Xlint, #Sarib's solution worked for me and both the -Xlint errors disappeared after running flutter pub upgrade, flutter pub get and flutter clean. You can find them under Tools > Flutter in Android Studio if you are not familiar with Terminal.
For multidex, according to the Android Studio User Guide, multidex is enabled by default if your minSdkVersion is 21 or higher. While #Joshi suggests enabling multidex, I think it is simpler to update the minSdkVersion in android/app/build.gradle file to 21 or higher, rather than mess with more variables and adding more dependencies, assuming you're building an app that targets Android21 or higher.
For this error:
Note: locationInD\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
The solution I found was to replace this line in android/app/build.gradle:
implementation 'com.google.firebase:firebase-analytics-ktx'
with
implementation 'com.google.firebase:firebase-analytics'
For me i changed one of my implementation version from
implementation platform('com.google.firebase:firebase-bom:27.1.0') to
implementation platform('com.google.firebase:firebase-bom:26.6.0')
at the moment there are some bugs in this current version "27.1.0" and after running the application it worked
//To help someone my project needed this implementation for my ads #admob
change to minSdkVersion 24
in android/app/build.gradle
dependencies {
//add this in your dependencies
implementation "androidx.multidex:multidex:2.0.0"
}
then
$ flutter clean
$ flutter run
I had the same issue and combined two suggested fixes to get it to finally work:
minSdkVersion 21, change to 23
run "flutter pub upgrade"
= issues fixed!
To double-check what the fix was:
I also reverted back to 21 and invalidated + flutter clean and the issue appeared again. Then I changed to 23 and the warnings disappeared!
Check your minSDK, it works fine for 23
The dialog (Google form) for the credentials is opened successfully, but after I fill my credentials I'm getting this error. I followed the instructions from here. Created a Firebase project, enabled the Google Drive API (that's what I need for now) from the Google APIs Console.
The code throwing the exception:
final GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'https://www.googleapis.com/auth/drive',
],
);
await _googleSignIn.signIn();
That's the stack trace:
E/flutter ( 5068): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter ( 5068): PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
E/flutter ( 5068): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7)
E/flutter ( 5068): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:292:18)
E/flutter ( 5068): <asynchronous suspension>
E/flutter ( 5068): #2 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:226:58)
E/flutter ( 5068): <asynchronous suspension>
E/flutter ( 5068): #3 GoogleSignIn._addMethodCall (package:google_sign_in/google_sign_in.dart:268:20)
E/flutter ( 5068): #4 GoogleSignIn.signIn (package:google_sign_in/google_sign_in.dart:339:48)
E/flutter ( 5068): #5 ThatsMyComponentState.theSignInFuction.<anonymous closure> (package:my_app/widgets/my_file.dart:666:45)
E/flutter ( 5068): <asynchronous suspension>
E/flutter ( 5068): #6 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14)
E/flutter ( 5068): #7 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30)
E/flutter ( 5068): #8 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter ( 5068): #9 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter ( 5068): #10 TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:204:7)
E/flutter ( 5068): #11 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter ( 5068): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:184:20)
E/flutter ( 5068): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
E/flutter ( 5068): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
E/flutter ( 5068): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 5068): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
E/flutter ( 5068): #17 _invoke1 (dart:ui/hooks.dart:168:13)
E/flutter ( 5068): #18 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)
The version of the google_sign_in plugin is 4.0.0.
That's the output of flutter doctot -v:
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17763.253], locale en-US)
• Flutter version 1.0.0 at C:\src\flutter-0.7.3\flutter
• Framework revision 5391447fae (10 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at C:\Users\myuser\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = C:\Users\myuser\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 32.0.1
• Dart plugin version 182.5124
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[!] IntelliJ IDEA Community Edition (version 2018.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.6
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.io/intellij-setup/#installing-the-plugins
[!] VS Code, 64-bit edition (version 1.30.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
! Doctor found issues in 2 categories.
Any help will be much appreciated. Thanks!
I run into the same issue just now. This might happens if you are running on debug and you did not register a SHA fingerprint in firebase.
I solved it by generating a debug.keystore and registering it inside the app on Firebase. Don't forget to download the new google-services.json after that.
See also this.
Edit
If you are not able to use authenticate in release mode try the following:
-Add the SHA certificate fingerprints of the release key.
keytool -exportcert -list -v \
-alias <your-key-name> -keystore <path-to-production-keystore>
For more details on that see here on the section "get release certificate" https://developers.google.com/android/guides/client-auth
If your authentication is still not working, probably it is because you downloaded the app from Playstore and you enabled the "App Signing by Google Play Feature"
Then for this case, go to play store publish console and go to app signing under release management. There you will find the SHA certificate fingerprint to register in Firebase console.
I spent ages trying to fix this.
1. Open grade.properties This file is found under: {{YOUR PROJECT}}/android/gradle.properties
2. Add the following argument to 'org.gradle.jvmargs' as shown in the screenshot.
-XX:MaxHeapSize=256m -Xmx256m
3. Right click on 'gradlew' and go to 'Open in Terminal'
This file is found under {{YOUR PROJECT}}/android/gradlew
4. Type in the following command.
gradlew signingReport
If did not work first try second command:
./gradlew signingReport
5. Wait for the compilation to finish and your SHA keys should be printed out for you.
Use these keys to authenticate your app in https://console.firebase.google.com/
The following solution works in flutter project:
Step 1: Generate SHA1 and SHA256 keys.
Step 2: Add both the SHA1 and SHA256 to firebase. (in you app settings)
Step 3: Download google-services.json to android/app in your project folder.
Step 4: In your terminal run the command flutter clean .
Step 5: Run your flutter app.
For more information visit:
https://developers.google.com/android/guides/client-auth
https://firebase.google.com/docs/flutter/setup
Open the Firebase console and click on the settings icon.
You will see the list of the apps connected to your Firebase project
For Android
Open terminal inside your flutter project
cd android
./gradlew signingReport or gradlew signingReport
Paste your SHA1 key
Download and replace the google-services.json
flutter clean
IOS:
Configure your Firebase project
Select IOS
Enter your Bundle ID
Download credetials
Download and replace GoogleService-info.plist
Add this to your info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>**INSERT HERE YOUR RESERVED_CLIENT_ID FROM GoogleService-Info.plist**</string>
</array>
</dict>
</array>
When I came across this problem, I tried all other solutions described in this post. None of these worked. Eventually I figured it out: In my situation I had to make sure to have my "support email" set.
For me I didn't need to add extra SHAs, I realized I didn't enable the Google Sign-in method in the Authentication tab in Firebase console
Additional steps you might have to take in order for google_sign_in to work:
Link GooglePlay with Firebase [(https://github.com/flutter/flutter/issues/27599)
If you could run Google Sign In during debug but NOT in release, there is a high chance that you did not add your release key's SHA1 and SHA256 to firebase.
To get the release key's SHAs, use keytool -list -v -keystore ~/key.jks -alias key
You should end up with total of at least 6 SHA credentials: 2 from the debug key, 2 from Google Play linking, and 2 from the release key. Note that you do not need to redownload the google-services.json file after adding the release SHA credentials to firebase.
Add GooglePlay Proguard rules (https://github.com/flutter/flutter/issues/19102)
# Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
# GooglePlay Services
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
-keep class com.google.common.** { *; }
-dontwarn com.google.common.**
If your released app is not working properly, and you are using Google Play Signing, Copy the SHA from your play store account, the one from your local key will not work
I found a solution for the error com.google.android.gms.common.api.ApiException: 10: I solved it by adding more keys to the firebase. initially I thought it was stupid and useless, then in the end it turned out to be the solution (I added up to 10 SHA, don't worry if that's a lot).
Where did I find all these keys?
I found all these keys by entering the android folder and typing the command ./gradlew signingReport (I use linux, it also works on mac. For windows the command is gradlew signingReport)
After that?
After that, he printed out a very long list of keys in my terminal, and I took all the ones that were different, that were at the top of the list.
Note: you will get all the keys (both debug and release) of each package of the app, but rest assured that all those of the packages are the same and only for debugging (so you will have to take these same keys only once)
Finally
Once you have all the app keys, go to your project's Firebase settings, scroll down and add any keys you found.
After that, you will need to download the google-services.json file again and run a flutter clean in your project's local folder on your computer.
Now you can build your app and see if it works!
I hope this could help someone.
"Flutter clean" its the piece that everybody is missing after register the SHA1 in Firebase Console!
The answer that given early are right. None of them are false. But if you still face the error PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null). One thing that your should check is your OAuth 2.0 Client IDs
Go to : https://console.cloud.google.com/apis/credentials
Select your project on the top left screen
Create Client ID base on your platform (iOS or Android)
Just follow the next steps
Once you successfully generate the client ID, then your application will works as expected.
--- Note ---
But first, make sure you have regitered your SHA-1, package id email support and has been download the google service json from your firebase console project.
You have missed configuration step enable google login on firebase.
Google sign-in is automatically configured on your connected iOS and web apps. To set up Google sign-in for your Android apps, you need to add the SHA1 fingerprint for each app on your Project Settings.
✅ Just complete these enough steps below
Enable Google Auth Method
Configure certificate fingerprints in your current project at project-level setting. How to Generate certificate.
Select email for Project support email
Download google-service.json into your project.
Run flutter clean
start flutter run
For platform exception 10, try this:
Generate a new SHA1 fingerprint on your machine,
Go to your firebase android app setting in Firebase Console
Click on add new fingerprint in your android app settings
Paste the new SHA1 fingerprint into the field
Generate a new json config file
Replace the config file in android directory
Run flutter clean
Run your project
One reason that you might be experiencing this error is if you did not fill out google's OAuth consent form. This is a new change to Firebase.
Here are the steps you need to follow to fill out the consent form for your app:
Navigate to the google api console (currently at https://console.developers.google.com), make sure you are logged into your account which your firebase project is created under.
Select your project from the "select a project" dropdown in top left of the developer console.
In the left hand pane travel to "credentials" and then switch to the "OAuth consent screen".
Under "Application name" enter your application's public name
Under "Application logo" upload a local image file of your application
Under "Support email" enter the same support email listed in your firebase application.
Scroll down and fill out the "Application Homepage Link", "Application Privacy Policy Link", and "Application Terms of Service Link" by adding http:// before the authorized domain which your firebase app lives at.
Click Save
These steps worked for me! While the link may not still exist, I'd like to reference the source of this solution here
make sure you have added
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
}
in android/build.gradle and
apply plugin: 'com.google.gms.google-services'
in android/app/build.gradle. Also, make sure applicationId in android/app/build.gradle is the same as your package name in AndroidManifest.xml(You may forget to change applicationId after changing package name sometimes). This applicatioonId or package name in manifest file should be the
name of your android package name in firebase app.
This happened to me also when I have reinstalled my OS.
Just run ./gradlew signingReportand copy the SHA-1 and SHA-256 into Firebase config "add fingerprint"
This might seem silly, but that just happened to me now (after having some experience working with firebase in the past). I noticed that I did not enable Google authentication. Make sure you do that, as you might still see the login prompt (showing you your phone's google users, without it being enabled).
I tried all of the above answers and none worked. I'm putting my solution here in case someone runs into an edge case like mine:
Mine didn't work with the above answers because I'm installing the app via Firebase App Tester (Firebase Distribution) and it resigned the app with entirely new test certificates, not the usual debug or release certificates you can get from Android Studio
To solve it, go to Firebase App Distribution from Firebase Console and copy the test certificates SHA-1 and SHA-256
Enter these new certificates in Firebase Project Settings
You should generate SHA-1 and SHA-256 for each pc that you used. And add them all to firebase project settings.
And you should fill the form in OAuth Consent tab.
In my case, none of the answers solved the problem. After some thinking, I realized that sometime ago I have changed the package name of my application. If it is your case, you should simply create another application inside your Firebase project with your new package name and download google-services.json file again.
If it previously worked but now are using a different PC, you'll need to add new SHA-1/SHA-256 fingerprints generated by that PC to your project in Firebase. A good step-by-step example on doing that: https://stackoverflow.com/a/56091158/5365164
This answer has already more 30 answer but this is more COMPLETE STEP BY STEP APPROACH to solve this bug.
Most likely you do not have debug.keystore in your C/User/.android directory. To generate one, do the following
$ keytool -genkey -v -keystore debug.keystore -storepass android
-alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
use organization name Android
country code US
and name Android Debug
when you have done so, navigate to your android flutter directory where gradlew is located and do the following
./gradlew signingReport
You will have list of SHA1 SHA256 keys. copy both keys that is named debug.keystore to your flutter project firebase project settings (where you download google-services.json)
Flutter clean and rebuild your project.
Make sure SHA-1 must be a debug key which is generated in your system only, and then download google-services.json file append that to your project
I had the issue and took 5 hours to get it solved. I remember I read somewhere that API Exception 10 means that there is an issue with the fingerprints. So, it had to be the keystore or a misconfiguration in firebase. Eventually, it was the keystore. I'm still not sure of why this worked but this is what I did, by the way, I'm using Windows 10:
1.) Make sure that on the file android/build.gradle I had the following:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
2.) I added these two lines to the file android/gradle.properties
android.useAndroidX=true
android.enableJetifier=true
3.) Navigated to C:\Users\YOURUSER\.android and deleted the following:
debug.keystore
debug.keystore.lock
4.) Open the terminal as admin, and generated the debug keystore in this directory.
$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
Obtained the fingerprints:
$ keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android
5.) Added the SHA1 fingerprints to the configuration in firebase
That was it on my end. I hope it helps someone.
Please make sure you do this:
Enable google sign in from your firebase console
Put your SHA-1 when setup your android firebase app
After signed in with the same account with which you have created the Firebase project.You have fill in this consenst
https://console.developers.google.com/apis/credentials/consent
However, the answers given above are correct, but still, if you are having issue then don't forget to verify the signingConfig {} section of the app/build.gradle. It should not have any unwanted keystore file reference, which may be causing a mismatch with google-services.json and the keystore.
In my case it was a silly mistake,make sure that your applicationId in firebase like : 'com.example.appname' matches exactly with the applicationId in your app/src/build.gradle file,under the defaultConfig{}.No spelling errors,no upper case,lower case letter conflicts.In my case one letter was upper case which caused all the problems.
Along with the steps suggested by others
running
./gradlew clean
worked for me.
Changing the date on your phone manually also results in a Platform Exception when trying to sign in with google. At least with the flutter google-sign-in library.
Got the same issue. I checked the signingReport and found that the release SHA1 and SHA256 were different from others. I added these values in firebase and re-downloaded the goggle-services.json. This solved the issue.
Also, run flutter clean before building apk.