top of page

[Flutter/dart] Use google_sign_in in 2 firebase projects(Android)


Overview


If you're using firebase, you want to separate your development environment from your production environment.


In this process in Flutter, I stumbled on Android's google_sign_in


Detail


Create two firebase projects, one for development and one for production, and start them in debug mode. Then, I get the following error in google_sign_in.


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


This is because in google_sing_in (in firebase?) the combination of the application id (like com. ***) and the SHA1 fingerprint cannot be duplicated.

(See here for details. However, the error did not go away even with the measures described here.)



Solution


As a workaround, change the application id when in debug mode.

Write as follows in /android/app/build.gradle.


defaultConfig {
    applicationId "com.xxx.yyy"
    ・・・
}
buildTypes {
    debug {
        applicationIdSuffix ".debug"
    }
    ・・・    
}

Also, modify /android/app/src/debug/google-service.json as follows.


"client": [
  {
    "client_info": {
      ・・・
      "android_client_info": {
        "package_name": "com.xxx.yyy.debug"
      }
    },

Without this modification, you get the following error.

Execution failed for task ':app:processDebugGoogleServices'.

> No matching client found for package name 'com.xxx.yyy



After taking the above measures, I was able to sign in with google safely.

Recent Posts

See All

[Flutter/Dart] Format string with TextField

What want to do I want to create an input form using TextField. For example, if the input content is a monetary amount, I would like to display it in 3-digit delimiters with a ¥ prefix. Rather than ha

댓글


Let's do our best with our partner:​ ChatReminder

iphone6.5p2.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Let's do our best with our partner:​ ChatReminder

納品:iPhone6.5①.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Theme diary: Decide the theme and record for each genre

It is a diary application that allows you to post and record with themes and sub-themes for each genre.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png
bottom of page