Dart 在Android上使用Firebase Facebook和Google登录时出现问题

Dart 在Android上使用Firebase Facebook和Google登录时出现问题,dart,flutter,firebase-authentication,facebook-login,google-login,Dart,Flutter,Firebase Authentication,Facebook Login,Google Login,我不能在我的Flitter应用程序中使用firebase登录facebook或google。它在ios上运行良好 它不会收到提供者的确认,也不会抛出成功或错误。它不能在模拟器或真实设备上工作。通过电子邮件登录工作完美 我的登录码: final _auth = FirebaseAuth.instance; _auth.onAuthStateChanged.listen((user) { if (user != null) { //get useer data

我不能在我的Flitter应用程序中使用firebase登录facebook或google。它在ios上运行良好

它不会收到提供者的确认,也不会抛出成功或错误。它不能在模拟器或真实设备上工作。通过电子邮件登录工作完美

我的登录码:

final _auth = FirebaseAuth.instance;

    _auth.onAuthStateChanged.listen((user) {
      if (user != null) {
        //get useer data
      } else {
        //go to login page
      }
    });

Future<Null> _loginByFacebook(Completer completer) async {

  FacebookLogin facebookLogin = new FacebookLogin();
  FacebookLoginResult result = await facebookLogin.logInWithReadPermissions(['email', 'public_profile']);

  switch (result.status) {
    case FacebookLoginStatus.loggedIn:
      AuthCredential credential = FacebookAuthProvider.getCredential(accessToken: result.accessToken.token);
      FirebaseAuth.instance.signInWithCredential(credential);
      completer.complete();
      break;
    case FacebookLoginStatus.cancelledByUser:
      break;
    case FacebookLoginStatus.error:
      completer.completeError(result.errorMessage);
  }
}

Future<Null> _loginByGoogle( Completer completer) async {
  try {
    await GoogleSignIn().signIn();
    completer.complete();
  } catch (error) {

    completer.completeError(error);
    print(error);
  }
}
当我尝试谷歌登录时,只会显示:
D/EGL_仿真(19022):eglMakeCurrent:0xa1285cc0:ver 2 0(tinfo 0xa1283840)

猜猜问题出在哪里?:)

更新:我可以使用Google登录将代码更新为:

Future<Null> _loginByGoogle( Completer completer) async {
  try {
    final GoogleSignIn _googleSignIn = GoogleSignIn();

    final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
    final GoogleSignInAuthentication googleAuth = await googleUser.authentication;


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

    await _auth.signInWithCredential(credential);

    completer.complete();
  } catch (error) {

    completer.completeError(error.message);
    print(error);
  }
}
Future\u loginByGoogle(Completer-Completer)异步{
试一试{
最终GoogleSignIn _GoogleSignIn=GoogleSignIn();
final GoogleSignInAccount googleUser=wait_googleSignIn.signIn();
最终GoogleSignInAuthentication googleAuth=等待googleUser.authentication;
final AuthCredential credential=GoogleAuthProvider.getCredential(
accessToken:googleAuth.accessToken,
idToken:googleAuth.idToken,
);
使用凭证(凭证)等待授权登录;
completer.complete();
}捕获(错误){
completer.completeError(错误消息);
打印(错误);
}
}

但是,Facebook的登录问题保持不变。当它请求登录时,不会得到结果(成功或失败)

我也有同样的问题。你找到解决办法了吗。我修复了在pubspec中更新包的问题
D/        (19022): HostConnection::get() New Host Connection established 0x8fe3ca80, tid 19059
D/EGL_emulation(19022): eglMakeCurrent: 0x9cba4460: ver 2 0 (tinfo 0xa1283790)
I/flutter (19022): user not logged :`(
W/System  (19022): ClassLoader referenced unknown path: /system/app/Chrome/lib/x86
I/WebViewFactory(19022): Loading com.android.chrome version 51.0.2704.90 (code 275509012)
I/cr_LibraryLoader(19022): Time to load native libraries: 1 ms (timestamps 9943-9944)
I/cr_LibraryLoader(19022): Expected native library version number "51.0.2704.90", actual native library version number "51.0.2704.90"
V/WebViewChromiumFactoryProvider(19022): Binding Chromium to main looper Looper (main, tid 1) {2441051}
I/cr_LibraryLoader(19022): Expected native library version number "51.0.2704.90", actual native library version number "51.0.2704.90"
I/chromium(19022): [INFO:library_loader_hooks.cc(143)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_BrowserStartup(19022): Initializing chromium process, singleProcess=true
E/ApkAssets(19022): Error while loading asset assets/natives_blob_64.bin: java.io.FileNotFoundException: assets/natives_blob_64.bin
E/ApkAssets(19022): Error while loading asset assets/snapshot_blob_64.bin: java.io.FileNotFoundException: assets/snapshot_blob_64.bin
D/EGL_emulation(19022): eglCreateContext: 0x86b79440: maj 2 min 0 rcv 2
D/EGL_emulation(19022): eglMakeCurrent: 0x86b79440: ver 2 0 (tinfo 0x8b5c1ef0)
W/cr_media(19022): Requires BLUETOOTH permission
D/cr_Ime  (19022): [InputMethodManagerWrapper.java:30] Constructor
W/cr_AwContents(19022): onDetachedFromWindow called when already detached. Ignoring
D/cr_Ime  (19022): [InputMethodManagerWrapper.java:59] isActive: false
I/cr_Ime  (19022): ImeThread is not enabled.
E/libEGL  (19022): validate_display:99 error 3008 (EGL_BAD_DISPLAY)
I/VideoCapabilities(19022): Unsupported profile 4 for video/mp4v-es
D/        (19022): HostConnection::get() New Host Connection established 0x821595c0, tid 19100
D/EGL_emulation(19022): eglCreateContext: 0x82103120: maj 2 min 0 rcv 2
D/EGL_emulation(19022): eglMakeCurrent: 0x82103120: ver 2 0 (tinfo 0x827c98b0)
D/EGL_emulation(19022): eglMakeCurrent: 0xa1285cc0: ver 2 0 (tinfo 0xa1283840)
D/EGL_emulation(19022): eglMakeCurrent: 0xa1285cc0: ver 2 0 (tinfo 0xa1283840)
D/EGL_emulation(19022): eglMakeCurrent: 0xa1285cc0: ver 2 0 (tinfo 0xa1283840)
W/cr_BindingManager(19022): Cannot call determinedVisibility() - never saw a connection for the pid: 19022
D/cr_Ime  (19022): [InputMethodManagerWrapper.java:59] isActive: false
D/EGL_emulation(19022): eglMakeCurrent: 0xa1285cc0: ver 2 0 (tinfo 0xa1283840)
W/art     (19022): Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation(19022): eglMakeCurrent: 0xa1285cc0: ver 2 0 (tinfo 0xa1283840)
Future<Null> _loginByGoogle( Completer completer) async {
  try {
    final GoogleSignIn _googleSignIn = GoogleSignIn();

    final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
    final GoogleSignInAuthentication googleAuth = await googleUser.authentication;


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

    await _auth.signInWithCredential(credential);

    completer.complete();
  } catch (error) {

    completer.completeError(error.message);
    print(error);
  }
}