凭据的对话框(谷歌表单)已成功打开,但在我填写凭据后,我得到这个错误。我是按照这里的指示做的。创建了一个Firebase项目,启用谷歌驱动器API(这是我现在需要的)从谷歌API控制台。

抛出异常的代码:

final GoogleSignIn _googleSignIn = GoogleSignIn(
  scopes: [
    'https://www.googleapis.com/auth/drive',
  ],
);

await _googleSignIn.signIn();

这是堆栈跟踪:

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)

google_sign_in插件版本为4.0.0。

这是颤振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.

任何帮助都将不胜感激。谢谢!


当前回答

我得到这个错误: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 7:,null)也许解决方案对你有好处。

我意识到我的调试设备(android调试模式)没有连接到互联网。 我认为身份验证失败,所以方法返回null或用户等于null。

返回的变量必须在使用前检查。

其他回答

我遇到了这个问题,花了5个小时才解决。我记得我在某个地方读到过,API Exception 10意味着指纹有问题。因此,它必须是密钥库或firebase中的错误配置。最终,它是密钥库。我仍然不确定为什么这样做有效,但这就是我所做的,顺便说一下,我使用的是Windows 10:

1)。确保在文件android/build中。我有以下几点:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

2)。我将这两行添加到文件android/gradle.properties中

android.useAndroidX=true
android.enableJetifier=true

3)。导航到c:\ users \ youruser \。并删除了以下内容:

debug.keystore
debug.keystore.lock

4)。以admin打开终端,并在此目录中生成调试密钥存储库。

$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

获得指纹:

$ keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android 

5)。firebase配置中增加了SHA1指纹

我这边就这样了。我希望它能帮助到一些人。

构建appbundle(谷歌Play and Flutter推荐使用)会导致此错误。构建apk将解决这个问题。

参见58194425

“颤振清洁”是在Firebase控制台注册SHA1后每个人都缺少的一块!

我找到了一个解决方案的错误com.google.android.gms.common.api.ApiException: 10:我解决了它通过添加更多的密钥到firebase。最初我认为这是愚蠢和无用的,但最后它被证明是解决方案(我加了10个SHA,如果很多也不用担心)。

我从哪里找到这些钥匙的?

我通过进入android文件夹并键入命令./gradlew signingReport找到了所有这些键(我使用linux,它也适用于mac。对于windows命令是gradlew signingReport)

后呢?

在那之后,他在我的终端上打印了一长串密钥,我把所有不同的,排在列表顶端的密钥都拿出来。

注意:你将获得应用程序每个包的所有密钥(包括调试和发布),但请放心,所有这些包都是相同的,只用于调试(所以你只需要一次使用这些相同的密钥)

最后

一旦你有了所有的应用程序密钥,转到项目的Firebase设置,向下滚动并添加你找到的任何密钥。 之后,你需要下载google的服务。Json文件,并在您的项目的本地文件夹在您的计算机上运行颤振清理。

现在你可以构建你的应用程序,看看它是否工作!

我希望这能帮助到一些人。

当我重新安装我的操作系统时,我也遇到了这种情况。 只需运行。/gradlew signingreport,复制SHA-1和SHA-256到Firebase配置add fingerprint