认证Google登录时出现问题

时间:2020-10-28 03:28:08

标签: flutter dart

请,我需要有关在我的应用程序中验证Google登录身份的帮助。以下是我的身份验证代码,也许有些地方我不正确。我不断收到此错误:

失败:构建失败,并出现异常。

  • 出了什么问题: 无法确定任务':google_sign_in:compileDebugAidl'的依赖关系。

在以下位置找不到带有哈希字符串“ android-29”的目标:C:\ Users \ Dennis \ AppData \ Local

Future<User>gSignin() async {
  final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
  final GoogleSignInAuthentication googleSignInAuthentication =
      await googleSignInAccount.authentication;

  final AuthCredential credential = GoogleAuthProvider.credential(
      idToken: googleSignInAuthentication.idToken,
      accessToken: googleSignInAuthentication.accessToken);

  final UserCredential authResult =
      await _auth.signInWithCredential(credential);

  final User user = authResult.user;

  final User currentUser = _auth.currentUser;

  assert(currentUser.uid == user.uid);

  print('User: ${user.displayName}');

  return user;
}

Pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  carousel_pro: ^1.0.0
  cupertino_icons: ^1.0.0
  firebase_auth: ^0.18.1+2
  firebase_core: ^0.5.0+1
  font_awesome_flutter: ^8.10.0
  google_sign_in: ^4.5.5
  provider: ^4.3.2+2

请我需要帮助。谢谢。

1 个答案:

答案 0 :(得分:0)

google_sign_in: ^4.5.5删除“ ^”

如果它不适合您,请尝试使用此link