简体   繁体   English

使用 flutter 验证 google 登录时出现问题

[英]Having an issue authenticating google sign in with flutter

So I'm trying different approaches to make authentication with flutter to work with no success.所以我正在尝试不同的方法来使颤动的身份验证无法成功地工作。

Before posting the code it's important to say that I couldn't make the google services 4.3.3 work with any Gradle version so I have changed the versions to Gradle 3.2.1 and google services to 4.2.0 and I checked connectivity with firebase and it works.在发布代码之前,重要的是要说明我无法让 google services 4.3.3 与任何 Gradle 版本一起工作,所以我将版本更改为 Gradle 3.2.1 并将 google services 更改为 4.2.0 并且我检查了与 firebase 的连接和有用。 Plus, I added SHA1.另外,我添加了 SHA1。

I can't track the error causing the application to fail and it's not the first post I have uploaded about it and I have searched online so many solutions with no success.我无法跟踪导致应用程序失败的错误,这不是我上传的第一篇关于它的帖子,我在网上搜索了很多解决方案都没有成功。

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.2.0'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-analytics:17.2.1'
}
apply plugin: 'com.google.gms.google-services'

main class主类

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'ProfileScreen.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Google Signin APP',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primaryColor: Color(0xff9C58D2),
      ),
      home: GoogleSignApp(),
    );
  }

} }

class GoogleSignApp extends StatefulWidget {
  @override
  _GoogleSignAppState createState() => _GoogleSignAppState();
}

class _GoogleSignAppState extends State<GoogleSignApp> {

  final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
  final GoogleSignIn _googlSignIn = new GoogleSignIn();

  Future<FirebaseUser> _signIn(BuildContext context) async {

    Scaffold.of(context).showSnackBar(new SnackBar(
      content: new Text('Sign in'),
    ));

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

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

    FirebaseUser userDetails = (await _firebaseAuth.signInWithCredential(credential)) as FirebaseUser;
    ProviderDetails providerInfo = new ProviderDetails(userDetails.providerId);

    List<ProviderDetails> providerData = new List<ProviderDetails>();
    providerData.add(providerInfo);

    UserDetails details = new UserDetails(
      userDetails.providerId,
      userDetails.displayName,
      userDetails.photoUrl,
      userDetails.email,
      providerData,
    );
    Navigator.push(
      context,
      new MaterialPageRoute(
        builder: (context) => new ProfileScreen(detailsUser: details),
      ),
    );
    return userDetails;
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Builder(
        builder: (context) => Stack(
          fit: StackFit.expand,
          children: <Widget>[
            Container(
              width: MediaQuery.of(context).size.width,
              height:  MediaQuery.of(context).size.height,
              child: Image.network(
                  'https://images.unsplash.com/photo-1518050947974-4be8c7469f0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60'
                  ,fit: BoxFit.fill,
                  color: Color.fromRGBO(255, 255, 255, 0.6),
                  colorBlendMode: BlendMode.modulate
              ),
            ),
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                SizedBox(height:10.0),
                Container(
                    width: 250.0,
                    child: Align(
                      alignment: Alignment.center,
                      child: RaisedButton(
                        shape: RoundedRectangleBorder(
                            borderRadius: new BorderRadius.circular(30.0)),
                        color: Color(0xffffffff),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Icon(FontAwesomeIcons.google,color: Color(0xffCE107C),),
                            SizedBox(width:10.0),
                            Text(
                              'Sign in with Google',
                              style: TextStyle(color: Colors.black,fontSize: 18.0),
                            ),
                          ],),
                        onPressed: () => _signIn(context)
                            .then((FirebaseUser user) => print(user))
                            .catchError((e) => print(e)),
                      ),
                    )
                ),

                Container(
                    width: 250.0,
                    child: Align(
                      alignment: Alignment.center,
                      child: RaisedButton(
                        shape: RoundedRectangleBorder(
                            borderRadius: new BorderRadius.circular(30.0)),
                        color: Color(0xffffffff),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Icon(FontAwesomeIcons.facebookF,color: Color(0xff4754de),),
                            SizedBox(width:10.0),
                            Text(
                              'Sign in with Facebook',
                              style: TextStyle(color: Colors.black,fontSize: 18.0),
                            ),
                          ],),
                        onPressed: () {},
                      ),
                    )
                ),
                Container(
                    width: 250.0,
                    child: Align(
                      alignment: Alignment.center,
                      child: RaisedButton(
                        shape: RoundedRectangleBorder(
                            borderRadius: new BorderRadius.circular(30.0)),
                        color: Color(0xffffffff),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: <Widget>[
                            Icon(FontAwesomeIcons.solidEnvelope,color: Color(0xff4caf50),),
                            SizedBox(width:10.0),
                            Text(
                              'Sign in with Email',
                              style: TextStyle(color: Colors.black,fontSize: 18.0),
                            ),
                          ],),
                        onPressed: () {},
                      ),
                    )
                ),
              ],
            ),
          ],
        ),),
    );
  }
}



class UserDetails {
  final String providerDetails;
  final String userName;
  final String photoUrl;
  final String userEmail;
  final List<ProviderDetails> providerData;

  UserDetails(this.providerDetails,this.userName, this.photoUrl,this.userEmail, this.providerData);
}


class ProviderDetails {
  ProviderDetails(this.providerDetails);
  final String providerDetails;

} }

ProfileScreen class ProfileScreen类

import 'package:flutter/material.dart';
import 'main.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:google_sign_in/google_sign_in.dart';



class ProfileScreen extends StatelessWidget {
  final UserDetails detailsUser;

  ProfileScreen({Key key, @required this.detailsUser}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final GoogleSignIn _gSignIn =  GoogleSignIn();

    return  Scaffold(
        appBar:  AppBar(
          title:  Text(detailsUser.userName),
          automaticallyImplyLeading: false,
          actions: <Widget>[
            IconButton(
              icon: Icon(
                FontAwesomeIcons.signOutAlt,
                size: 20.0,
                color: Colors.white,
              ),
              onPressed: (){
                _gSignIn.signOut();
                print('Signed out');
                Navigator.pop(context);

              },
            ),
          ],
        ),
        body:Center(child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            CircleAvatar(
              backgroundImage:NetworkImage(detailsUser.photoUrl),
              radius: 50.0,
            ),
            SizedBox(height:10.0),
            Text(
              "Name : " + detailsUser.userName,
              style:  TextStyle(fontWeight: FontWeight.bold, color: Colors.black,fontSize: 20.0),
            ),
            SizedBox(height:10.0),
            Text(
              "Email : " + detailsUser.userEmail,
              style:  TextStyle(fontWeight: FontWeight.bold, color: Colors.black,fontSize: 20.0),
            ),
            SizedBox(height:10.0),
            Text(
              "Provider : " + detailsUser.providerDetails,
              style:  TextStyle(fontWeight: FontWeight.bold, color: Colors.black,fontSize: 20.0),
            ),
          ],
        ),)
    );
  }
}

after the two suggestions this is the run log在这两个建议之后这是运行日志

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
I/zygote  ( 7873): Background concurrent copying GC freed 13033(968KB) AllocSpace objects, 13(228KB) LOS objects, 62% free, 907KB/2MB, paused 5.177ms total 65.168ms
Syncing files to device Android SDK built for x86...
D/EGL_emulation( 7873): eglMakeCurrent: 0xa6c85960: ver 2 0 (tinfo 0xa6c83c10)
I/zygote  ( 7873): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.auth.api.signin.internal.SignInHubActivity>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/FragmentActivity;
I/zygote  ( 7873):   at android.content.Intent com.google.android.gms.auth.api.signin.internal.zzh.zzc(android.content.Context, com.google.android.gms.auth.api.signin.GoogleSignInOptions) ((null):5)
I/zygote  ( 7873):   at android.content.Intent com.google.android.gms.auth.api.signin.GoogleSignInClient.getSignInIntent() ((null):20)
I/zygote  ( 7873):   at void io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.signIn(io.flutter.plugin.common.MethodChannel$Result) (GoogleSignInPlugin.java:291)
I/zygote  ( 7873):   at void io.flutter.plugins.googlesignin.GoogleSignInPlugin.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (GoogleSignInPlugin.java:77)
I/zygote  ( 7873):   at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:222)
I/zygote  ( 7873):   at void io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(java.lang.String, byte[], int) (DartMessenger.java:96)
I/zygote  ( 7873):   at void io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(java.lang.String, byte[], int) (FlutterJNI.java:656)
I/zygote  ( 7873):   at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
I/zygote  ( 7873):   at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:325)
I/zygote  ( 7873):   at void android.os.Looper.loop() (Looper.java:142)
I/zygote  ( 7873):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6541)
I/zygote  ( 7873):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/zygote  ( 7873):   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
I/zygote  ( 7873):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
I/zygote  ( 7873): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.FragmentActivity" on path: DexPathList[[zip file "/data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/base.apk"],nativeLibraryDirectories=[/data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86, /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
I/zygote  ( 7873):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
I/zygote  ( 7873):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
I/zygote  ( 7873):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/zygote  ( 7873):   at android.content.Intent com.google.android.gms.auth.api.signin.internal.zzh.zzc(android.content.Context, com.google.android.gms.auth.api.signin.GoogleSignInOptions) ((null):5)
I/zygote  ( 7873):   at android.content.Intent com.google.android.gms.auth.api.signin.GoogleSignInClient.getSignInIntent() ((null):20)
I/zygote  ( 7873):   at void io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.signIn(io.flutter.plugin.common.MethodChannel$Result) (GoogleSignInPlugin.java:291)
I/zygote  ( 7873):   at void io.flutter.plugins.googlesignin.GoogleSignInPlugin.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (GoogleSignInPlugin.java:77)
I/zygote  ( 7873):   at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:222)
I/zygote  ( 7873):   at void io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(java.lang.String, byte[], int) (DartMessenger.java:96)
I/zygote  ( 7873):   at void io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(java.lang.String, byte[], int) (FlutterJNI.java:656)
I/zygote  ( 7873):   at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
I/zygote  ( 7873):   at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:325)
I/zygote  ( 7873):   at void android.os.Looper.loop() (Looper.java:142)
I/zygote  ( 7873):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6541)
I/zygote  ( 7873):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/zygote  ( 7873):   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
I/zygote  ( 7873):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
I/zygote  ( 7873): 
E/flutter ( 7873): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/signin/internal/SignInHubActivity;
E/flutter ( 7873):  at com.google.android.gms.auth.api.signin.internal.zzh.zzc(Unknown Source:5)
E/flutter ( 7873):  at com.google.android.gms.auth.api.signin.GoogleSignInClient.getSignInIntent(Unknown Source:20)
E/flutter ( 7873):  at io.flutter.plugins.googlesignin.GoogleSignInPlugin$Delegate.signIn(GoogleSignInPlugin.java:291)
E/flutter ( 7873):  at io.flutter.plugins.googlesignin.GoogleSignInPlugin.onMethodCall(GoogleSignInPlugin.java:77)
E/flutter ( 7873):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/flutter ( 7873):  at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/flutter ( 7873):  at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/flutter ( 7873):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 7873):  at android.os.MessageQueue.next(MessageQueue.java:325)
E/flutter ( 7873):  at android.os.Looper.loop(Looper.java:142)
E/flutter ( 7873):  at android.app.ActivityThread.main(ActivityThread.java:6541)
E/flutter ( 7873):  at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 7873):  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
E/flutter ( 7873):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
E/flutter ( 7873): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
E/flutter ( 7873):  at java.lang.VMClassLoader.findLoadedClass(Native Method)
E/flutter ( 7873):  at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
E/flutter ( 7873):  at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
E/flutter ( 7873):  at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/flutter ( 7873):  ... 14 more
E/flutter ( 7873): Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/FragmentActivity;
E/flutter ( 7873):  ... 14 more
E/flutter ( 7873): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.FragmentActivity" on path: DexPathList[[zip file "/data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/base.apk"],nativeLibraryDirectories=[/data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86, /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
E/flutter ( 7873):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
E/flutter ( 7873):  at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/flutter ( 7873):  at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/flutter ( 7873):  ... 14 more
E/flutter ( 7873): 
F/flutter ( 7873): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env). 
F/libc    ( 7873): Fatal signal 6 (SIGABRT), code -6 in tid 7873 (ntication_demo2)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86:8.0.0/OSR1.180418.019/5598391:userdebug/dev-keys'
Revision: '0'
ABI: 'x86'
pid: 7873, tid: 7873, name: ntication_demo2  >>> omermichleviz.com.authentication_demo2 <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env). 
'
    eax 00000000  ebx 00001ec1  ecx 00001ec1  edx 00000006
    esi 00001ec1  edi bff981e8
    xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
    eip b49e3ac4  ebp bff98208  esp bff9819c  flags 00200296
backtrace:
    #00 pc 00000ac4  [vdso:b49e3000] (__kernel_vsyscall+16)
    #01 pc 00075b3c  /system/lib/libc.so (tgkill+28)
    #02 pc 0001f04e  /system/lib/libc.so (abort+110)
    #03 pc 01115f65  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #04 pc 0110443b  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #05 pc 01102202  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #06 pc 011622ad  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #07 pc 01114729  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #08 pc 01116ce8  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #09 pc 01116c2a  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #10 pc 0111d678  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #11 pc 0111d6a6  /data/app/omermichleviz.com.authentication_demo2-em0cledzfIMvQw6_BGX_Vg==/lib/x86/libflutter.so (offset 0x10fb000)
    #12 pc 000149b7  /system/lib/libutils.so (_ZN7android20SimpleLooperCallback11handleEventEiiPv+39)
    #13 pc 000157ec  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+988)
    #14 pc 00015386  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+118)
    #15 pc 000e4cbb  /system/lib/libandroid_runtime.so (_ZN7androidL38android_os_MessageQueue_nativePollOnceEP7_JNIEnvP8_jobjectxi+59)
    #16 pc 007b7df8  /system/framework/x86/boot-framework.oat (offset 0x5e9000) (android.app.NativeActivity.onWindowFocusChangedNative [DEDUPED]+136)
    #17 pc 00638d52  /system/lib/libart.so (art_quick_invoke_stub+338)
    #18 pc 00112b48  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+232)
    #19 pc 0032322f  /system/lib/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+367)
    #20 pc 0031be11  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+817)
    #21 pc 0061f83b  /system/lib/libart.so (MterpInvokeDirect+523)
    #22 pc 00629a21  /system/lib/libart.so (artMterpAsmInstructionStart+14369)
    #23 pc 002f5f89  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+537)
    #24 pc 002fdf0a  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+234)
    #25 pc 0031bde5  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+773)
    #26 pc 0061e1a1  /system/lib/libart.so (MterpInvokeVirtual+881)
    #27 pc 00629921  /system/lib/libart.so (artMterpAsmInstructionStart+14113)
    #28 pc 002f5f89  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+537)
    #29 pc 002fdf0a  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+234)
    #30 pc 0031bde5  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+773)
    #31 pc 0061fb24  /system/lib/libart.so (MterpInvokeStatic+484)
    #32 pc 00629aa1  /system/lib/libart.so (artMterpAsmInstructionStart+14497)
    #33 pc 002f5f89  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+537)
    #34 pc 002fddeb  /system/lib/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+139)
    #35 pc 0060e56f  /system/lib/libart.so (artQuickToInterpreterBridge+1375)
    #36 pc 0063edad  /system/lib/libart.so (art_quick_to_interpreter_bridge+77)
    #37 pc 00638f22  /system/lib/libart.so (art_quick_invoke_static_stub+418)
    #38 pc 00112b92  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+306)
    #39 pc 00533065  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+101)
    #40 pc 005350f6  /system/lib/libart.so (_ZN3art12InvokeMethodERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectS4_S4_j+1478)
    #41 pc 004a2450  /system/lib/libart.so (_ZN3artL13Method_invokeEP7_JNIEnvP8_jobjectS3_S3_+80)
    #42 pc 0026dbd8  /system/framework/x86/boot.oat (offset 0x1df000) (java.lang.Class.getDeclaredMethodInternal [DEDUPED]+168)
    #43 pc 00638d52  /system/lib/libart.so (art_quick_invoke_stub+338)
    #44 pc 00112b48  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+232)
    #45 pc 0032322f  /system/lib/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+367)
    #46 pc 0031be11  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+817)
    #47 pc 0061e1a1  /system/lib/libart.so (MterpInvokeVirtual+881)
    #48 pc 00629921  /system/lib/libart.so (artMterpAsmInstructionStart+14113)
    #49 pc 002f5f89  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+537)
    #50 pc 002fddeb  /system/lib/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+139)
    #51 pc 0060e56f  /system/lib/libart.so (artQuickToInterpreterBridge+1375)
    #52 pc 0063edad  /system/lib/libart.so (art_quick_to_interpreter_bridge+77)
    #53 pc 01618453  /system/framework/x86/boot-framework.oat (offset 0x5e9000) (com.android.internal.os.ZygoteInit.main+2707)
    #54 pc 00638f22  /system/lib/libart.so (art_quick_invoke_static_stub+418)
    #55 pc 00112b92  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+306)
    #56 pc 00533065  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+101)
    #57 pc 00532d29  /system/lib/libart.so (_ZN3art17InvokeWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDPc+441)
    #58 pc 004116d0  /system/lib/libart.so (_ZN3art3JNI21CallStaticVoidMethodVEP7_JNIEnvP7_jclassP10_jmethodIDPc+992)
    #59 pc 00152055  /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDPcNS_9Primitive4TypeENS_10InvokeTypeE+3237)
    #60 pc 0013eb0b  /system/lib/libart.so (_ZN3art8CheckJNI21CallStaticVoidMethodVEP7_JNIEnvP7_jclassP10_jmethodIDPc+75)
    #61 pc 000819be  /system/lib/libandroid_runtime.so (_ZN7_JNIEnv20CallStaticVoidMethodEP7_jclassP10_jmethodIDz+62)
    #62 pc 00083e96  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcRKNS_6VectorINS_7String8EEEb+838)
    #63 pc 00001db3  /system/bin/app_process32 (main+1603)
Lost connection to device.

Change this line改变这一行

FirebaseUser userDetails = (await _firebaseAuth.signInWithCredential(credential)) as FirebaseUser;

to

FirebaseUser userDetails = (await _firebaseAuth.signInWithCredential(credential)).user;

You can use your version with the following changes. 您可以使用您的版本进行以下更改。

Inside your module level build.gradle file, 在模块级别的build.gradle文件中,

classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50'

Then inside your android package > gradle > wrapper > gradle-wrapper.properties change the distributionUrl to following 然后在您的android程序包> gradle>包装器> gradle-wrapper.properties中,将distributionUrl更改为以下内容

distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

I hope you have enabled androidx Migration and added multidex dependencies as well. 我希望您已启用androidx迁移并也添加了multidex依赖项

Try this and it will work. 试试这个,它将起作用。 I am using it in all my projects. 我在所有项目中都使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM