google_sign_in_android
7.2.18Android implementation of the google_sign_in plugin.
Showing cached metadata. Upstream refresh is currently unavailable.
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.jsonfile and Gradle-based registration system, no identifiers need to be provided in Dart when initializing theGoogleSignIninstance when running on Android, as long as yourgoogle-services.jsoncontains 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 theserverClientIdwhen initializing theGoogleSignIninstance.
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 ofGoogleSignInExceptionCode.clientConfigurationError.- Unexpected
GoogleSignInExceptions with a code ofGoogleSignInExceptionCode.canceledafter selecting an account during the authentication process.- Some configuration errors will cause the underlying
Android
CredentialManagerSDK to return a "canceled" error in this flow, and unfortunately thegoogle_sign_inplugin has no way to distinguish this case from the user canceling sign-in, so cannot return a more accurate error message.
- Some configuration errors will cause the underlying
Android
- 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.jsoncontains a web OAuth client, which should be anoauth_cliententry withclient_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-downloadgoogle-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 forREQUEST_CODE_AUTHORIZEis 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
clearAuthorizationTokenmethod.
7.0.5
- Adds support for
hostedDomainwhen 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
serverClientIdconfiguration 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:guavafrom32.0.1to33.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
clearAuthCacheoverride 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
targetCompatibiltymatchingsourceCompatibilityfor 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
serverClientIdvia the channelledinitcall
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.initWithParamsto handle newforceCodeForRefreshTokenparameter.
6.0.1
- Updates gradle version to 7.2.1 on Android.
6.0.0
- Deprecates
clientIdand adds support forserverClientIdinstead. HistoricallyclientIdwas interpreted asserverClientId, but only on Android. On other platforms it was interpreted as the OAuthclientIdof the app. For backwards-compatibilityclientIdwill still be used as a server client ID ifserverClientIdis not provided. - BREAKING CHANGES:
- Adds
serverClientIdparameter toIDelegate.init(Java).
- Adds
5.2.8
- Suppresses
deprecationwarnings (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_inas a federated implementation.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add google_sign_in_androidpubspec.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
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 5.2.5 | On demand | Download | 86c228e7…d24db9 |
| 5.2.6 | On demand | Download | 174791e4…555741 |
| 5.2.7 | On demand | Download | 6d1e3c4e…8736ed |
| 5.2.8 | On demand | Download | 12941b9b…89e334 |
| 6.0.0 | On demand | Download | 00036045…4e3112 |
| 6.0.1 | On demand | Download | 23f5f2ac…9767fa |
| 6.1.0 | On demand | Download | 92896339…28b24c |
| 6.1.1 | On demand | Download | 25449f21…cac6da |
| 6.1.2 | On demand | Download | 4002eafe…d8052e |
| 6.1.3 | On demand | Download | 9892d3f7…26e9ea |
| 6.1.4 | On demand | Download | 41187ee4…1b33d2 |
| 6.1.5 | On demand | Download | 19722807…4faccc |
| 6.1.6 | On demand | Download | 612bf44d…840c5c |
| 6.1.7 | On demand | Download | f27bd565…b2e2e5 |
| 6.1.8 | On demand | Download | 6a740e84…fe1cca |
| 6.1.9 | On demand | Download | 2efe7a35…8be73c |
| 6.1.11 | On demand | Download | 8e46e791…398b4a |
| 6.1.12 | On demand | Download | 4a8ea590…fea39d |
| 6.1.13 | On demand | Download | 1c9b7953…c57c7d |
| 6.1.14 | On demand | Download | 2a8b90b7…9dd7fc |
| 6.1.15 | On demand | Download | e89179df…085b95 |
| 6.1.16 | On demand | Download | f58a17ac…d5d150 |
| 6.1.17 | On demand | Download | 258864d6…b65439 |
| 6.1.18 | On demand | Download | 8d60a787…d9ffc3 |
| 6.1.19 | On demand | Download | 8d76099c…0b012d |
| 6.1.20 | On demand | Download | 6031f590…db80ef |
| 6.1.21 | On demand | Download | bfd42c81…bb0a49 |
| 6.1.22 | On demand | Download | 38cef11e…3be93e |
| 6.1.23 | On demand | Download | 7647893c…a4632e |
| 6.1.24 | On demand | Download | 8f2606ff…628eb3 |
| 6.1.25 | On demand | Download | 60e4f794…047b8f |
| 6.1.26 | On demand | Download | d3d38e0a…593e1d |
| 6.1.27 | On demand | Download | d30fb34b…654cb3 |
| 6.1.28 | On demand | Download | 5a47ebec…3cf077 |
| 6.1.30 | On demand | Download | 0608de03…3a49d8 |
| 6.1.31 | On demand | Download | 1ad54110…b5474a |
| 6.1.32 | On demand | Download | 1fc52467…7e1fd9 |
| 6.1.33 | On demand | Download | 0928059d…599c01 |
| 6.1.34 | On demand | Download | 3b96f9b6…761e36 |
| 6.1.35 | On demand | Download | 7af72e55…032748 |
| 6.1.36 | On demand | Download | 4d23ff3e…43829f |
| 6.2.0 | On demand | Download | 4e52c643…83d21b |
| 6.2.1 | On demand | Download | d5e23c56…fa2805 |
| 7.0.0 | On demand | Download | ac7cfb82…df0d7b |
| 7.0.1 | On demand | Download | dc03996c…5bbbcb |
| 7.0.2 | On demand | Download | 8cb9bc7a…80f3c3 |
| 7.0.3 | On demand | Download | f256b8f0…d555b4 |
| 7.0.4 | On demand | Download | 5b7dd3e5…57c767 |
| 7.0.5 | On demand | Download | 666c3a13…fbd9c0 |
| 7.1.0 | On demand | Download | d2c80c17…7815a0 |
| 7.2.0 | On demand | Download | 7abdfa00…503e5c |
| 7.2.1 | On demand | Download | 799165f4…1adad3 |
| 7.2.2 | On demand | Download | 7a0d3b7e…e29034 |
| 7.2.4 | On demand | Download | 80edba83…6d9b02 |
| 7.2.5 | On demand | Download | eff4ad55…66335f |
| 7.2.6 | On demand | Download | 13759dc6…7fa2c7 |
| 7.2.7 | On demand | Download | 5ec98ab3…bdd8bb |
| 7.2.9 | On demand | Download | f3531405…d30917 |
| 7.2.10 | On demand | Download | be0d0733…731f76 |
| 7.2.11 | On demand | Download | df5c1553…fde812 |
| 7.2.12 | On demand | Download | 7fe17511…44e620 |
| 7.2.13 | On demand | Download | 5b89f1d3…0e7af8 |
| 7.2.14 | On demand | Download | dd86f662…a08d8c |
| 7.2.15 | On demand | Download | a01d4fd5…26e40b |
| 7.2.16 | On demand | Download | 57782125…5ef22e |
| 7.2.17 | On demand | Download | c403315d…7f1c00 |
| 7.2.18 | Cached · Upstream SHA-256 matched | Download | 312e74b3…a66480 |
Dependencies
flutter {
"sdk": "flutter"
}
google_sign_in_platform_interface "^3.1.0"
meta "^1.10.0"