flutter 获取handleWindowVisibility错误:没有活动为令牌Android.os.BinderProxy@bf6ebe3

j5fpnvbx  于 2023-05-01  发布在  Flutter
关注(0)|答案(1)|浏览(157)

我在我的应用程序中添加了Google登录功能,当按下登录按钮时,我会出现以下异常。我使用Flutter框架。

handleWindowVisibility: no activity for token android.os.BinderProxy@bf6ebe3
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807): Failed to handle method call
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807): java.lang.IllegalStateException: Concurrent operations detected: signIn, disconnect
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.checkAndSetPendingOperation(GoogleSignInPlugin.java:327)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.checkAndSetPendingOperation(GoogleSignInPlugin.java:322)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.disconnect(GoogleSignInPlugin.java:461)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.plugins.googlesignin.GoogleSignInPlugin.onMethodCall(GoogleSignInPlugin.java:184)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at android.os.Looper.loop(Looper.java:224)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at android.app.ActivityThread.main(ActivityThread.java:7561)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
E/MethodChannel#plugins.flutter.io/google_sign_in_android( 7807):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
I/Timeline( 7807): Timeline: Activity_launch_request time:548046764

有没有人得到同样的错误,并解决了这个问题,请帮助我解决这个问题。我一直在寻找没有得到解决的错误。有一个GitHub问题,没有解决就关闭了。
重新检查了所有firebase设置、Oauth同意和配置。有没有我遗漏的步骤,请帮忙。

w7t8yxp5

w7t8yxp51#

我在这里回答我的问题,我已经解决了这个问题。
在实现Google登录时,有多种情况会出现异常。在我的情况下,谷歌标志打电话多次。
第一种情况。

void handleGoogleSignIn() async {
      final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn();
      final GoogleSignInAuthentication? googleAuth =
          await googleUser?.authentication;
      final credential = GoogleAuthProvider.credential(
        accessToken: googleAuth?.accessToken,
        idToken: googleAuth?.idToken,
      ); }

//Disconnect function
googleSignIn.disconnect();

请确保只调用上述两个函数一次。
这可能发生在处理自动登录、检查互联网以注销和自动注销时。您将在一个屏幕上处理两个或三个进程的功能,请小心处理。
第二个场景。
如果您没有在OAuthConsent中使用Google Console 1(https://console.cloud.google.com/apis)中的所有详细信息进行配置,则可能会出现异常。此外,您需要确保已将SHA1添加到项目应用程序中。

相关问题