【问题标题】:PlatformException(sign_in_failed, Status{statusCode=CANCELED, resolution=null}, null) error in FlutterFlutter 中的 PlatformException(sign_in_failed, Status{statusCode=CANCELED, resolution=null}, null) 错误
【发布时间】:2018-09-26 15:39:37
【问题描述】:

我使用了google_sign_in 3.0.5 包并按照文档中给出的说明使用了完全相同的代码。

谁能告诉我在按照说明操作时我可能遗漏了什么,以及我必须做些什么才能让它发挥作用。

【问题讨论】:

  • 发布你的踪迹。
  • 我很想知道这个问题的解决方法,它对我也不起作用

标签: dart flutter google-oauth


【解决方案1】:

您需要使用 SHA-1 对您的客户端进行身份验证。在终端中执行此操作以生成 SHA-1

keytool -exportcert -list -v \ -alias androiddebugkey -keystore %USERPROFILE%.android\debug.keystore

或按照说明here

然后,当您需要将 SHA-1 复制到 Firebase 上的项目设置中时

【讨论】:

  • 是的,我已经完成了这两件事,我已经将我的两个依赖项设置为:classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.google.gms :google-services:4.0.1'
  • 不要使用classpath 'com.google.gms:google-services:4.0.1 -> 使用classpath 'com.google.gms:google-services:3.2.1' firebase.google.com/docs/flutter/setup
  • 不,这会使我的应用程序崩溃,我认为我没有以正确的方式链接我的密钥。你能告诉我我的密钥需要放在哪里以及我应该如何编辑我的 build.gradle 文件以指向这个密钥@JanMer
  • 你在说什么键?
  • 您应用的@Sebastian 密钥库签名
【解决方案2】:

statusCode="Canceled" 的原因是因为我没有更新我的“android/app/build.gradle”文件以使其指向我的密钥库/密钥

android {
    compileSdkVersion 27

    lintOptions {
        disable 'InvalidPackage'
    }

    signingConfigs {
        release {
            storeFile file("path to key/ key") # .keystore or .jsk file extensions
            storePassword 'password'
            keyAlias 'alias'
            keyPassword 'password'
        }
        debug {
            storeFile file("path to key/ key") # .keystore or .jsk file extensions
            storePassword 'password'
            keyAlias 'alias'
            keyPassword 'password'
        }        
    }    

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.applicationName"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
        debug {
            signingConfig signingConfigs.debug
        }        
    }
}

【讨论】:

    猜你喜欢
    • 2019-02-14
    • 1970-01-01
    • 2022-11-02
    • 2019-10-04
    • 2014-02-12
    • 2016-11-08
    • 2017-11-25
    • 2022-10-24
    • 2019-11-29
    相关资源
    最近更新 更多