You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无Firebase环境下Flutter Google Sign-In报ApiException 10错误求助

未使用Firebase的Flutter项目集成Google Sign-In时遇到ApiException:10错误求助

在未使用Firebase的Flutter项目中集成Google Sign-In时,出现以下错误:
PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)

相关代码

final api = GoogleSignIn();

Future<void> _signIn() async {
  try {
    var user = await api.signIn();
    print(user);
  } catch (e) {
    logger.e(e);
  }
}

密钥配置文件key.properties内容

storePassword=password
keyPassword=password
keyAlias=keyAlias
storeFile=keystore-file-path.jks

Android构建配置文件android/app/build.gradle.kts相关代码

signingConfigs {
    create("release") {
        keyAlias = keystoreProperties["keyAlias"] as String
        keyPassword = keystoreProperties["keyPassword"] as String
        storeFile = keystoreProperties["storeFile"]?.let { file(it) }
        storePassword = keystoreProperties["storePassword"] as String
    }
}
    

buildTypes {
    release {
        signingConfig = signingConfigs.getByName("release")
    }
}

flutter doctor -v检测结果

[✓] Flutter (Channel stable, 3.29.3, on Microsoft Windows [Version 10.0.26100.3775], locale en-US) [550ms]
    • Flutter version 3.29.3 on channel stable at C:\Flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ea121f8859 (5 weeks ago), 2025-04-11 19:10:07 +0000
    • Engine revision cf56914b32
    • Dart version 3.7.2
    • DevTools version 2.42.3

[✓] Windows Version (Windows 11 or higher, 24H2, 2009) [5.2s]

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [4.8s]
    • Android SDK at C:\Users\dev\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.1
    • Java binary at: C:\Program Files\Java\jdk-17\bin\java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe) [170ms]
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.6) [168ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.13.35931.197
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2024.3) [23ms]
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)

[✓] VS Code (version 1.100.0) [21ms]
    • VS Code at C:\Users\dev\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.110.0

[✓] Connected device (3 available) [601ms]
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 16 (API 36) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.26100.3775]
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 136.0.3240.64

[✓] Network resources [745ms]
    • All expected network resources are available.

已完成的操作

  • 生成密钥库并完成Android签名配置
  • 在Google Cloud Console中配置了应用的SHA1值
  • 未引入Firebase依赖及google-services.json文件
  • 查阅官方文档及平台、GitHub上的同类问题解决方案,均未解决当前问题

内容的提问来源于stack exchange,提问作者tjpin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 03:05:57