Home > database >  When I log in using google_sign_in in Flutter App, PlatformException(sign_in_failed, com.google.andr
When I log in using google_sign_in in Flutter App, PlatformException(sign_in_failed, com.google.andr

Time:02-26

I am developing a Flutter App using google_sign_in. https://pub.dev/packages/google_sign_in

When I log in using google_sign_in in Flutter App, an error occurs:

PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)

This only happens on the Android Emulator.

Building with Flutter v1.26 works fine, but only when building with Flutter v2.10.

Flutter App signing was done normally, and the hash value was properly registered in Firebase.

This is the cert value of app-release.apk.

Signer #1:

Signature:

Owner: CN=Raymond Jeon, OU=Dev, O=Dev, L=Seoul, ST=Seoul, C=KR
Issuer: CN=Raymond Jeon, OU=Dev, O=Dev, L=Seoul, ST=Seoul, C=KR
Serial number: 2a08edea
Valid from: Thu Aug 12 11:53:45 KST 2021 until: Mon Dec 28 11:53:45 KST 2048
Certificate fingerprints:
     MD5:  D9:B4:24:A9:XX:XX:XX:03:8B:44:41:DC:C6:78:E2:87
     SHA1: D9:94:3F:B7:XX:XX:XX:XX:68:22:A8:5D:23:78:07:8A:67:16:EE:C3
     SHA256: 0B:47:15:B3:XX:XX:XX:XX:37:A3:51:CF:53:2A:42:42:EB:D5:91:25:BE:3F:7B:0E:49:58:73:36:1A:DF:AA:3A
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: B0 XX XX XX 0B 79 27 3D   B9 00 D0 C1 92 20 F6 3F  .....y'=..... .?
0010: 60 B0 A0 2B                                        `.. 
]
]

The information below is the same as the SHA1 value registered in firebase.

SHA1: D9:94:3F:B7:XX:XX:XX:XX:68:22:A8:5D:23:78:07:8A:67:16:EE:C3

Why is this only happening in Flutter v2.10?

I downloaded the google-services.json file again and installed it.

I modified android/app/build.gradle file.

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation 'com.google.android.gms:play-services-basement:18.0.0'
    implementation 'com.google.firebase:firebase-analytics:20.1.0'
    implementation 'com.google.firebase:firebase-crashlytics:18.2.8'
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:29.1.0')
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

I modified android/build.gradle too.

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'  // Google Services plugin
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' // firebase crashlytics
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://naver.jfrog.io/artifactory/maven/'
        }
    }
}

flutter doctor -v

[✓] Flutter (Channel stable, 2.10.2, on macOS 12.0.1 21A559 darwin-arm, locale en-KR)
    • Flutter version 2.10.2 at /Users/gracegyu/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 097d3313d8 (6 days ago), 2022-02-18 19:33:08 -0600
    • Engine revision a83ed0e5e3
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/gracegyu/Library/Android/sdk
    • Platform android-31, build-tools 32.0.0
    • ANDROID_HOME = /Users/gracegyu/Library/Android/sdk
    • Java binary at: /Users/gracegyu/.Trash/Android Studio(Intel).app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11 0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
                 
  • Related