I ran my flutter app in release mode and decided to test my google sign in authentication, on debug mode it works pretty well but when I try in release mode flutter run --release
and click the google signin button I get this error
[ 24158 ms] E/flutter ( 1858): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)]
Unhandled Exception: PlatformException(sign_in_failed, m3.b: 10: , null, null)
[ 1 ms] E/flutter ( 1858): #0 StandardMethodCodec.decodeEnvelope
(package:flutter/src/services/message_codecs.dart:653)
[ ] E/flutter ( 1858): #1 MethodChannel._invokeMethod
(package:flutter/src/services/platform_channel.dart:296)
[ 1 ms] E/flutter ( 1858): <asynchronous suspension>
[ 1 ms] E/flutter ( 1858): #2 MethodChannel.invokeMapMethod
(package:flutter/src/services/platform_channel.dart:499)
[ 1 ms] E/flutter ( 1858): <asynchronous suspension>
[ 1 ms] E/flutter ( 1858): #3 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:273)
[ 1 ms] E/flutter ( 1858): <asynchronous suspension>
[ ] E/flutter ( 1858): #4 GoogleSignIn.signIn.isCanceled
(package:google_sign_in/google_sign_in.dart:407)
[ ] E/flutter ( 1858): <asynchronous suspension>
[ ] E/flutter ( 1858):
i don't know where the issue is coming from, i have tried creating my signing keys (SHA1 & SHA256) and added to firebase and downloaded the service json. Still nothing has changed
$ flutter doctor -v
[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 6.3.9600], locale en-US)
• Flutter version 3.3.4 on channel stable at D:\flutter\Sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision eb6d86ee27 (9 weeks ago), 2022-10-04 22:31:45 -0700
• Engine revision c08d7d5efc
• Dart version 2.18.2
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\bright\AppData\Local\Android\sdk
• Platform android-33, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C " workload, including all of its default components
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.73.1)
• VS Code at C:\Users\bright\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.54.0
[√] Connected device (4 available)
• Infinix X652A (mobile) • 0494625032002068 • android-arm64 • Android 9 (API 28)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 6.3.9600]
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.54
• Edge (web) • edge • web-javascript • Microsoft Edge 107.0.1418.62
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
google_sign_in: ^5.4.2
firebase_auth: ^3.11.1
firebase_core: ^1.24.0
Please what do you think is the cause of this issue and how can I go about fixing it
If you still need extra piece of information or code please tell me.
CodePudding user response:
The issue you are experiencing is likely due to the fact that you have not added the release version of your app's SHA-1 fingerprint to your Firebase project.
To fix this, you will need to:
- Generate a release key for your app by following the instructions at https://flutter.dev/docs/deployment/android#signing-the-app.
- Add the release key's SHA-1 fingerprint to your Firebase project by following the instructions at https://firebase.google.com/docs/android/setup#console.
- Download the updated google-services.json file from the Firebase console and add it to your app's android/app directory.
After completing these steps, try running your app in release mode again and see if the issue is resolved. If you continue to experience issues, please provide more details about the error message you are seeing so that we can provide more specific help.