【发布时间】:2020-01-31 07:32:55
【问题描述】:
我正在使用 firebase_auth 和 google_sign_in 构建一个 Flutter 应用程序。
在一段时间内一切都运行良好,我在已发布产品上的所有现有用户都没有遇到任何问题,但不久前我开始收到新用户无法登录的报告。我没想太多直到报告开始积累。我发现他们收到了标题中发布的错误。我花了很多时间调查...
我已经浏览了此问题的所有其他 StackOverflow 条目:
- Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
- PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
- Exception has occurred. PlatformException (PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null))
- Flutter: Firebase: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
- Flutter: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
- Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
- com.google.android.gms.common.api.ApiException: 10:
- com.google.android.gms.common.api.ApiException: 10
- How to correct " com.google.android.gms.common.api.ApiException: 10: "
- Firebase Google Signin error: com.google.android.gms.common.api.ApiException: 10
- Google sign in failed com.google.android.gms.common.api.ApiException: 10:
- Why do I get com.google.android.gms.common.api.ApiException: 10:?
- Error with Google_sign_in plugin in flutter
我已经尝试了所有的解决方案:
- Generated debug key
- 在Firebase site 上输入了 SHA1 调试密钥
- 已验证我的电子邮件已输入到 Firebase 网站。
- 下载了google-services.json文件,放到
android/app/目录下 - 使用
flutter build appbundle --debug构建flutter应用 - PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
所以我也试过了:
- 仅使用 Firebase 站点上的发布密钥并使用
flutter build appbundle --release构建 - 同时使用发布密钥和调试密钥
- 上述每个组合使用 SHA256
对于这些组合,我确定
flutter clean并将 google-services.json 文件替换为更新后的文件已验证
android/build.gradle和android/app/build.gradle是 configured properly- 已验证“Google”已启用,因为在 Firebase 网站上启用了“登录方法”
- 我什至用我的应用名称、徽标、电子邮件、主页、隐私和服务条款链接填写了 OAuth consent screen 并保存了
以下是我正在运行的版本:
google_sign_in: ^4.0.7
firebase_auth: ^0.14.0+5
android/app/build.gradle 的相关部分:
dependencies {
implementation "androidx.appcompat:appcompat:1.1.0-alpha01"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation "com.google.android.gms:play-services-auth:16.0.1"
implementation "com.google.android.gms:play-services-identity:16.0.0"
implementation "com.android.support:support-v4:28.0"
}
apply plugin: 'com.google.gms.google-services'
android/build.gradle 的相关部分:
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
}
颤振医生输出:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0-rc1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.38.1)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
所有测试均使用 Firebase 上的 Robo 测试实验室在多台设备上完成(仅查看登录是否成功,而不是测试 UI)。
TLDR;
最后,我终于发现如果我使用flutter build apk(而不是appbundle)构建apk,它就可以工作。然后我意识到问题开始的时间与 Flutter 开始建议我生成 appbundles 而不是 apks 的时间差不多。
是否有人能够在生成 appbundle 时使用 google_sign_in 使用 Flutter 登录 BRAND NEW USER?(请记住,之前登录过早期版本应用程序的现有用户无需问题。)
【问题讨论】:
-
嗨,我在 Mac 上遇到了完全相同的问题,但该应用程序可以在 Windows 上运行。你使用的是什么操作系统?和java版本?我看到我们有相同的应用程序配置......如果我修复它,我会告诉你的!如果你修复它,请告诉我
-
@MauroSebastianVolpeParedes 我尝试在 Linux Mint 和 Windows 10 上构建。两者具有相同的行为(apk 有效,abb 错误)。 Windows 上的 jdk1.8.0_152。
-
您是从一开始就注册了 Play Signing,还是您有后来注册的现有应用?
-
@Pierre,已经有一段时间了,但我认为这是我在一段时间后注册 Play 签名的 Play 商店中现有的应用程序。这有什么关系?
-
试图看看这是否与签名认证有关,但可能不是。无法登录的设备之间有什么共同的模式吗?
标签: flutter firebase-authentication google-signin android-app-bundle googlesigninapi