问题
I've been trying to fix this for a while now but I can't solve it. When I use the google_sign_in plugin, I'm able to choose my account but it stops after that.
But after clicking...
Giving me this error(the same) when I click continue:
E/flutter (28971): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
Things I've done:
- I've searched for hours the error, the ApiException: 10, in Flutter and in Android in general.
- Adding a SHA1 key, I've followed multiple tutorials (each one is different one to another, which is really confusing).
- Downloaded the new JSON file.
- Flutter clean.
- Contemplated not using it.
- Asking here.
Right now I'm using:
- firebase_auth: ^0.11.1
- google_sign_in: ^4.0.1+3
The app is in debug mode. I don't have an account to publish in the Google Store.
Thank you in advance.
回答1:
You must register your fingerprint debug.keystore in firebase,
you probably only registered an release.keystore:
show debug.keystore (linux):
keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore
source: documentation
回答2:
If you are using Internal App Sharing to test Flutter builds on actual Android devices (like I am), there is another App Signing certificate fingerprint you need to add.
Find it using the left navigation of Google Play Console go to: Developer Tools -> Internal App Sharing
Select the App Certificate tab. Should look something like this:
Google Play - Internal App Sharing - Certificate
Copy the SHA1 key for your Internal test certificate and add it to the Firebase Console -> Project Settings -> [your Android app] -> SHA certificate fingerprints (use the button to Add fingerprint)
Download your updated google-services.json and update/add it in your android/app folder of your project.
This works with new users and existing users. I built the an appbundle (not APK) using flutter build appbundle
The above solution isn't documented anywhere by Google and I have not seen this solution elsewhere in the Flutter community. I came across this solution while poking around in the Google Play console after trying dozens of "fixes" that didn't work.
来源:https://stackoverflow.com/questions/56381137/error-with-google-sign-in-plugin-in-flutter