Viewing version 7.2.18. Open the latest package page.

google_sign_in_android

7.2.18

Android implementation of the google_sign_in plugin.

Download archive

Readme

google_sign_in_android

The Android implementation of google_sign_in.

Usage

This package is endorsed, which means you can simply use google_sign_in normally. This package will be automatically included in your app when you do, so you do not need to add it to your pubspec.yaml.

However, if you import this package to use any of its APIs directly, you should add it to your pubspec.yaml as usual.

Integration

To use Google Sign-In, you'll need to register your application, either using Firebase, or directly with Google Cloud Platform.

  • If you are using the google-services.json file and Gradle-based registration system, no identifiers need to be provided in Dart when initializing the GoogleSignIn instance when running on Android, as long as your google-services.json contains a web OAuth client entry.
  • If you are not using google-services.json, you need to pass the client ID of the web application you registered as the serverClientId when initializing the GoogleSignIn instance.

You will also need to enable any OAuth APIs that you want, using the Google Cloud Platform API manager. For example, if you want to mimic the behavior of the Google Sign-In example app, you'll need to enable the Google People API.

Troubleshooting

If you encounter persistent errors, check that you have followed all of the registration steps in the instructions above. Common signs of configuration errors include:

  • GoogleSignInExceptions with a code of GoogleSignInExceptionCode.clientConfigurationError.
  • Unexpected GoogleSignInExceptions with a code of GoogleSignInExceptionCode.canceled after selecting an account during the authentication process.
    • Some configuration errors will cause the underlying Android CredentialManager SDK to return a "canceled" error in this flow, and unfortunately the google_sign_in plugin has no way to distinguish this case from the user canceling sign-in, so cannot return a more accurate error message.
  • Sign-in working in one build configuration but not another.

Common sources of configuration errors include:

  • Missing or incorrect signing SHA for one or more build configurations.
  • Incorrect Android package name on the server side.
  • Missing or incorrect serverClientId.

If you are using google-services.json and receive a "serverClientId must be provided on Android" error message, check that:

  • Your google-services.json contains a web OAuth client, which should be an oauth_client entry with client_type: 3. This should have been created automatically when enabling Google Sign In using the Firebase console, but if not (or if it was later removed), add a web app to the project and then re-download google-services.json.
  • You correctly followed all of the Gradle configuration steps in the Firebase integration documentation.
Changelog

7.2.18

  • Converts Java implementation code to Kotlin.
  • Updates minimum supported SDK version to Flutter 3.41/Dart 3.11.

7.2.17

  • Updates pigeon dev_dependency to ^27.3.2 for analyzer 14 compatibility.

7.2.16

  • Keeps default_web_client_id resource from being stripped by resource shrinkers.

7.2.15

  • Fixes an IllegalStateException ("Reply already submitted") crash when an authorization activity result for REQUEST_CODE_AUTHORIZE is delivered more than once (for example after a configuration change or process death).

7.2.14

  • Uses Google Identity APIs to extract the user ID from the ID token.

7.2.13

  • Bumps com.google.android.gms:play-services-auth from 21.5.1 to 21.6.0.
  • Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.

7.2.12

  • Migrates to Built-in Kotlin to support AGP 9.
  • Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.

7.2.11

  • Bumps AndroidX Credentials to v1.6.0
  • Bumps Play Services Auth to v21.5.1
  • Bumps Android Identity GoogleID to v1.2.0

7.2.10

  • Updates build files from Groovy to Kotlin.

7.2.9

  • Simplifies internal code for Kotlin/Java interoperability.

7.2.8

  • Bumps kotlin_version to 2.3.0.

7.2.7

  • Bumps kotlin_version to 2.2.21.

7.2.6

  • Bumps com.android.tools.build:gradle from 8.12.1 to 8.13.1.

7.2.5

  • Updates to Pigeon 26.

7.2.4

  • Improves README and fixes minor typos.

7.2.3

  • Removed mockito-inline and updated to mockito-core 5.17.0.

7.2.2

  • Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9.

7.2.1

  • Resolves Gradle 9 deprecations.

7.2.0

  • Adds support for disconnect.

7.1.0

  • Adds support for the clearAuthorizationToken method.

7.0.5

  • Adds support for hostedDomain when authenticating.

7.0.4

  • Bumps com.android.tools.build:gradle to 8.12.1 and kotlin_version to 2.2.10.
  • Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.

7.0.3

  • Updates kotlin version to 2.2.0 to enable gradle 8.11 support.
  • Adds more details and troubleshooting for serverClientId configuration via Firebase.

7.0.2

  • Adds a README note about potentially confusing error returns from CredentialManager.

7.0.1

  • Passes an activity context when requesting credentials, fixing an issue that prevented signing in on some devices.

7.0.0

  • BREAKING CHANGE: Switches to implementing version 3.0 of the platform interface package, rather than 2.x, significantly changing the API surface.
  • Switches to Sign in with Google (CredentialManager) as the underlying SDK, removing usage of the deprecated Google Sign In for Android SDK.
  • Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.

6.2.1

  • Removes obsolete code related to supporting SDK <21.

6.2.0

  • Adds a sign-in field to allow clients to explicitly specify an account name.

6.1.36

  • Updates compileSdk 34 to flutter.compileSdkVersion.

6.1.35

  • Removes the dependency on the Guava library.

6.1.34

  • Removes unnecessary native code.

6.1.33

  • Updates Pigeon for non-nullable collection type support.

6.1.32

  • Updates Java compatibility version to 11.
  • Updates minimum supported SDK version to Flutter 3.24/Dart 3.5.

6.1.31

  • Bumps com.google.guava:guava from 32.0.1 to 33.3.1.

6.1.30

  • Temporarily downgrades Guava from version 33.3.0 to 32.0.1 to fix an R8 related error.

6.1.29

  • Updates Guava to version 33.3.0.

6.1.28

  • Updates lint checks to ignore NewerVersionAvailable.

6.1.27

  • Updates AGP version to 8.5.0.

6.1.26

  • Removes additional references to the v1 Android embedding.

6.1.25

  • Updates Guava to version 33.2.1.

6.1.24

  • Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
  • Removes support for apps using the v1 Android embedding.

6.1.23

  • Updates minSdkVersion to 19.
  • Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.

6.1.22

  • Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
  • Updates compileSdk version to 34.
  • Updates play-services-auth version to 21.0.0.

6.1.21

  • Updates clearAuthCache override to match base class declaration.
  • Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.

6.1.20

  • Updates play-services-auth version to 20.7.0.

6.1.19

  • Adds pub topics to package metadata.
  • Updates minimum supported SDK version to Flutter 3.7/Dart 2.19.

6.1.18

  • Updates play-services-auth version to 20.6.0.

6.1.17

  • Converts method channels to Pigeon.

6.1.16

  • Updates Guava to version 32.0.1.

6.1.15

  • Updates minimum supported SDK version to Flutter 3.3/Dart 2.18.
  • Updates Guava to version 32.0.0.

6.1.14

  • Fixes compatibility with AGP versions older than 4.2.

6.1.13

  • Adds targetCompatibilty matching sourceCompatibility for older toolchains.

6.1.12

  • Adds a namespace for compatibility with AGP 8.0.

6.1.11

  • Fixes Java warnings.

6.1.10

  • Sets an explicit Java compatibility version.

6.1.9

  • Updates play-services-auth version to 20.5.0.

6.1.8

  • Clarifies explanation of endorsement in README.
  • Aligns Dart and Flutter SDK constraints.
  • Updates compileSdkVersion to 33.

6.1.7

  • Updates links for the merge of flutter/plugins into flutter/packages.

6.1.6

  • Minor implementation cleanup
  • Updates minimum Flutter version to 3.0.

6.1.5

  • Updates play-services-auth version to 20.4.1.

6.1.4

  • Rolls Guava to version 31.1.

6.1.3

  • Updates play-services-auth version to 20.4.0.

6.1.2

  • Fixes passing serverClientId via the channelled init call

6.1.1

  • Corrects typos in plugin error logs and removes not actionable warnings.
  • Updates minimum Flutter version to 2.10.
  • Updates play-services-auth version to 20.3.0.

6.1.0

  • Adds override for GoogleSignIn.initWithParams to handle new forceCodeForRefreshToken parameter.

6.0.1

  • Updates gradle version to 7.2.1 on Android.

6.0.0

  • Deprecates clientId and adds support for serverClientId instead. Historically clientId was interpreted as serverClientId, but only on Android. On other platforms it was interpreted as the OAuth clientId of the app. For backwards-compatibility clientId will still be used as a server client ID if serverClientId is not provided.
  • BREAKING CHANGES:
    • Adds serverClientId parameter to IDelegate.init (Java).

5.2.8

  • Suppresses deprecation warnings (for using Android V1 embedding).

5.2.7

  • Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings.

5.2.6

  • Switches to an internal method channel, rather than the default.

5.2.5

  • Splits from google_sign_in as a federated implementation.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'google_sign_in_android:7.2.18'
pubspec.yaml
name: google_sign_in_android
description: Android implementation of the google_sign_in plugin.
repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
version: 7.2.18

environment:
  sdk: ^3.12.0
  flutter: ">=3.44.0"

flutter:
  plugin:
    implements: google_sign_in
    platforms:
      android:
        dartPluginClass: GoogleSignInAndroid
        package: io.flutter.plugins.googlesignin
        pluginClass: GoogleSignInPlugin

dependencies:
  flutter:
    sdk: flutter
  google_sign_in_platform_interface: ^3.1.0
  meta: ^1.10.0

dev_dependencies:
  build_runner: ^2.3.0
  flutter_test:
    sdk: flutter
  mockito: ^5.4.4
  pigeon: ^27.3.2

topics:
  - authentication
  - google-sign-in

# The example deliberately includes limited-use secrets.
false_secrets:
  - /example/android/app/google-services.json
  - /example/lib/main.dart

Version history

VersionPublishedArchiveSHA-256
5.2.5On demandDownload86c228e7…d24db9
5.2.6On demandDownload174791e4…555741
5.2.7On demandDownload6d1e3c4e…8736ed
5.2.8On demandDownload12941b9b…89e334
6.0.0On demandDownload00036045…4e3112
6.0.1On demandDownload23f5f2ac…9767fa
6.1.0On demandDownload92896339…28b24c
6.1.1On demandDownload25449f21…cac6da
6.1.2On demandDownload4002eafe…d8052e
6.1.3On demandDownload9892d3f7…26e9ea
6.1.4On demandDownload41187ee4…1b33d2
6.1.5On demandDownload19722807…4faccc
6.1.6On demandDownload612bf44d…840c5c
6.1.7On demandDownloadf27bd565…b2e2e5
6.1.8On demandDownload6a740e84…fe1cca
6.1.9On demandDownload2efe7a35…8be73c
6.1.11On demandDownload8e46e791…398b4a
6.1.12On demandDownload4a8ea590…fea39d
6.1.13On demandDownload1c9b7953…c57c7d
6.1.14On demandDownload2a8b90b7…9dd7fc
6.1.15On demandDownloade89179df…085b95
6.1.16On demandDownloadf58a17ac…d5d150
6.1.17On demandDownload258864d6…b65439
6.1.18On demandDownload8d60a787…d9ffc3
6.1.19On demandDownload8d76099c…0b012d
6.1.20On demandDownload6031f590…db80ef
6.1.21On demandDownloadbfd42c81…bb0a49
6.1.22On demandDownload38cef11e…3be93e
6.1.23On demandDownload7647893c…a4632e
6.1.24On demandDownload8f2606ff…628eb3
6.1.25On demandDownload60e4f794…047b8f
6.1.26On demandDownloadd3d38e0a…593e1d
6.1.27On demandDownloadd30fb34b…654cb3
6.1.28On demandDownload5a47ebec…3cf077
6.1.30On demandDownload0608de03…3a49d8
6.1.31On demandDownload1ad54110…b5474a
6.1.32On demandDownload1fc52467…7e1fd9
6.1.33On demandDownload0928059d…599c01
6.1.34On demandDownload3b96f9b6…761e36
6.1.35On demandDownload7af72e55…032748
6.1.36On demandDownload4d23ff3e…43829f
6.2.0On demandDownload4e52c643…83d21b
6.2.1On demandDownloadd5e23c56…fa2805
7.0.0On demandDownloadac7cfb82…df0d7b
7.0.1On demandDownloaddc03996c…5bbbcb
7.0.2On demandDownload8cb9bc7a…80f3c3
7.0.3On demandDownloadf256b8f0…d555b4
7.0.4On demandDownload5b7dd3e5…57c767
7.0.5On demandDownload666c3a13…fbd9c0
7.1.0On demandDownloadd2c80c17…7815a0
7.2.0On demandDownload7abdfa00…503e5c
7.2.1On demandDownload799165f4…1adad3
7.2.2On demandDownload7a0d3b7e…e29034
7.2.4On demandDownload80edba83…6d9b02
7.2.5On demandDownloadeff4ad55…66335f
7.2.6On demandDownload13759dc6…7fa2c7
7.2.7On demandDownload5ec98ab3…bdd8bb
7.2.9On demandDownloadf3531405…d30917
7.2.10On demandDownloadbe0d0733…731f76
7.2.11On demandDownloaddf5c1553…fde812
7.2.12On demandDownload7fe17511…44e620
7.2.13On demandDownload5b89f1d3…0e7af8
7.2.14On demandDownloaddd86f662…a08d8c
7.2.15On demandDownloada01d4fd5…26e40b
7.2.16On demandDownload57782125…5ef22e
7.2.17On demandDownloadc403315d…7f1c00
7.2.18Cached · Upstream SHA-256 matchedDownload312e74b3…a66480

Dependencies

flutter { "sdk": "flutter" }

google_sign_in_platform_interface "^3.1.0"

meta "^1.10.0"