-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#9497Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listfyi-androidFor the attention of Android platform teamFor the attention of Android platform teamp: google_sign_inThe Google Sign-In pluginThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
What package does this bug report belong to?
google_sign_in
What target platforms are you seeing this bug on?
Android
Have you already upgraded your packages?
Yes
Dependency versions
pubspec.lock
google_sign_in:
dependency: "direct main"
description:
name: google_sign_in
sha256: dba1a1a79368d8ca464bf36ef94f528851efa9925e4a28bfc4aaefb1f5da2fc4
url: "https://pub.dev"
source: hosted
version: "7.0.0"
google_sign_in_android:
dependency: transitive
description:
name: google_sign_in_android
sha256: ac7cfb8216dc34d18221cc4ec9e0a07346a00420a37c548d151ac8ad49df0d7b
url: "https://pub.dev"
source: hosted
version: "7.0.0"
google_sign_in_ios:
dependency: transitive
description:
name: google_sign_in_ios
sha256: "59937a674827540d12253415626ec24cc7e633bb785e2d2ca4f1580323e55a0c"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
google_sign_in_platform_interface:
dependency: transitive
description:
name: google_sign_in_platform_interface
sha256: "8736443134d2cccadd4f228d600177cb3947e36683466a6ab96877ce6932885a"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
google_sign_in_web:
dependency: transitive
description:
name: google_sign_in_web
sha256: "09ac306b2787b48f19c857b9f93375b654f774643c75bd6a1a078c85f4f7b468"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
Steps to reproduce
1 install dependencie google_sign_in: ^7.0.0
2 create page
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';
class LogInView extends StatefulWidget {
const LogInView({super.key});
@override
State<LogInView> createState() => _LogInViewState();
}
class _LogInViewState extends State<LogInView> {
final List<String> scopes = <String>[];
GoogleSignInAccount? _currentUser;
Future<void> _handleAuthenticationEvent(GoogleSignInAuthenticationEvent event) async {
// #docregion CheckAuthorization
final GoogleSignInAccount? user = // ...
// #enddocregion CheckAuthorization
switch (event) {
GoogleSignInAuthenticationEventSignIn() => event.user,
GoogleSignInAuthenticationEventSignOut() => null,
};
setState(() {
_currentUser = user;
});
// If the user has already granted access to the required scopes, call the
// REST API.
}
Future<void> _handleAuthenticationError(Object e) async {
print(e);
}
@override
void initState() {
super.initState();
// #docregion Setup
final GoogleSignIn signIn = GoogleSignIn.instance;
unawaited(
signIn
.initialize(
clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxx',
serverClientId: 'xxxxxxxxxxxxxx',
)
.then((_) {
signIn.authenticationEvents.listen(_handleAuthenticationEvent).onError(_handleAuthenticationError);
}),
);
// #enddocregion Setup
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: InkWell(
child: Text('Login'),
onTap: () async {
try {
await GoogleSignIn.instance.authenticate();
} catch (e) {
// #enddocregion ExplicitSignIn
print(e);
// #docregion ExplicitSignIn
}
},
),
),
);
}
}
3 remplace
clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxx'
serverClientId: 'xxxxxxxxxxxxxx'
4 clic in Login
Expected results
start with the Google login process
Actual results
get error
code: 11417212
Failed to launch the selector UI. Hint: ensure the context parameter is an Activity-based context.
Code sample
Code sample
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';
class LogInView extends StatefulWidget {
const LogInView({super.key});
@override
State<LogInView> createState() => _LogInViewState();
}
class _LogInViewState extends State<LogInView> {
final List<String> scopes = <String>[];
GoogleSignInAccount? _currentUser;
Future<void> _handleAuthenticationEvent(GoogleSignInAuthenticationEvent event) async {
// #docregion CheckAuthorization
final GoogleSignInAccount? user = // ...
// #enddocregion CheckAuthorization
switch (event) {
GoogleSignInAuthenticationEventSignIn() => event.user,
GoogleSignInAuthenticationEventSignOut() => null,
};
setState(() {
_currentUser = user;
});
// If the user has already granted access to the required scopes, call the
// REST API.
}
Future<void> _handleAuthenticationError(Object e) async {
print(e);
}
@override
void initState() {
super.initState();
// #docregion Setup
final GoogleSignIn signIn = GoogleSignIn.instance;
unawaited(
signIn
.initialize(
clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxx',
serverClientId: 'xxxxxxxxxxxxxx',
)
.then((_) {
signIn.authenticationEvents.listen(_handleAuthenticationEvent).onError(_handleAuthenticationError);
}),
);
// #enddocregion Setup
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: InkWell(
child: Text('Login'),
onTap: () async {
try {
await GoogleSignIn.instance.authenticate();
} catch (e) {
// #enddocregion ExplicitSignIn
print(e);
// #docregion ExplicitSignIn
}
},
),
),
);
}
}Screenshots or Videos
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
GoogleSignInException(code GoogleSignInExceptionCode.unknownError, Failed to launch the selector UI. Hint: ensure the `context` parameter is an Activity-based context., null)Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.32.4, on Ubuntu 24.04.2 LTS 6.11.0-26-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
! Unable to access driver information using 'eglinfo'.
It is likely available from your distribution (e.g.: apt install mesa-utils)
[✓] Android Studio (version 2024.3)
[✓] VS Code (version unknown)
✗ Unable to determine VS Code version.
[✓] Connected device (3 available)
[✓] Network resourcesmaRci002, 24Shaurya12, yocheco, jesuspmk, dragonqfly and 4 more
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listfyi-androidFor the attention of Android platform teamFor the attention of Android platform teamp: google_sign_inThe Google Sign-In pluginThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team