本文介绍了Firebase AuthUI:NoClassDefFoundError:无法解决以下问题:Lcom/google/android/gms/internal/zzbgl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我调用以下代码,我的应用程序就会崩溃:

My App crashes whenever I call this code:

if (FirebaseAuth.getInstance().getCurrentUser() == null) {
        startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setAvailableProviders(providers)
                        .setLogo(R.drawable.shape_circle)
                        .build(), RC_SIGN_IN);
    }

奇怪的是,这段代码一直到今天都有效,我在这里没有任何更改,也没有更改任何依赖项.但是直到今天,它因以下异常而崩溃:

The weird thing is this code always worked till today, I haven't changed anything here and I did not changed any dependencies. But just today it crashes with these Exceptions:

05-29 20:57:58.875 11408-11408/com.example.jonas.trainingslog1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.jonas.trainingslog1, PID: 11408
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbgl;
    at com.firebase.ui.auth.util.GoogleApiUtils.getCredentialsClient(GoogleApiUtils.java:20)
    at com.firebase.ui.auth.viewmodel.AuthViewModelBase.onCreate(AuthViewModelBase.java:32)
    at com.firebase.ui.auth.viewmodel.ViewModelBase.init(ViewModelBase.java:23)
    at com.firebase.ui.auth.KickoffActivity.onCreate(KickoffActivity.java:33)
    at android.app.Activity.performCreate(Activity.java:7130)
    at android.app.Activity.performCreate(Activity.java:7121)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1262)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2905)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3060)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:110)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1800)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6649)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
05-29 20:57:58.876 11408-11442/com.example.jonas.trainingslog1 V/FA:   Activity paused, time: 1808810
05-29 20:57:58.876 11408-11408/com.example.jonas.trainingslog1  E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find   class "com.google.android.gms.internal.zzbgl" on path: DexPathList[[zip   file "/system/framework/org.apache.http.legacy.boot.jar", zip file   "/data/app/com.example.jonas.trainingslog1-  zQJYHa_fJvVM5m38ZSfIlA==/base.apk", zip file  "/data/app/com.example.jonas.trainingslog1-  zQJYHa_fJvVM5m38ZSfIlA==/split_lib_dependencies_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1-  zQJYHa_fJvVM5m38ZSfIlA==/split_lib_resources_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1-  zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_0_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1-  zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_1_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1-  zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_2_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_3_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1-zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_4_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1-zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_5_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1-  zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.jonas.trainingslog1-   zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_7_apk.apk", zip file   "/data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_8_apk.apk", zip file  "/data/app/com.example.jonas.trainingslog1-zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectori es=[/data/app/com.example.jonas.trainingslog1-   zQJYHa_fJvVM5m38ZSfIlA==/lib/x86,  /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/base.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1-zQJYHa_fJvVM5m38ZSfIlA==/split_lib_dependencies_apk.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_resources_apk.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_0_apk.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_2_apk.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_5_apk.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_6_apk.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1-zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_7_apk.apk!/lib/x86,   /data/app/com.example.jonas.trainingslog1- zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_8_apk.apk!/lib/x86,  /data/app/com.example.jonas.trainingslog1-zQJYHa_fJvVM5m38ZSfIlA==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib]]
        at     dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        ... 19 more
    Suppressed: java.io.IOException: No original dex files found for   dex location /data/app/com.example.jonas.trainingslog1-   zQJYHa_fJvVM5m38ZSfIlA==/split_lib_resources_apk.apk
    at dalvik.system.DexFile.openDexFileNative(Native Method)
    at dalvik.system.DexFile.openDexFile(DexFile.java:354)
    at dalvik.system.DexFile.<init>(DexFile.java:101)
    at dalvik.system.DexFile.<init>(DexFile.java:75)
    at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
    at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
    at dalvik.system.DexPathList.<init>(DexPathList.java:157)
    at dalvik.system.BaseDexClassLoader.<init>. (BaseDexClassLoader.java:65)
    at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
    at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
05-29 20:57:58.877 11408-11408/com.example.jonas.trainingslog1 E/AndroidRuntime:     at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
    at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:72)
    at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:38)
    at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:715)
    at android.app.LoadedApk.getClassLoader(LoadedApk.java:750)
    at android.app.LoadedApk.getResources(LoadedApk.java:972)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2329)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
    at android.app.ActivityThread.access$1000(ActivityThread.java:198)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
            ... 6 more

这些是我的Firebase依赖项:

These are my Firebase dependencies:

compile 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.0'
implementation 'com.google.firebase:firebase-perf:16.0.0'
compile 'com.firebaseui:firebase-ui-auth:3.3.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.1'

任何主意可能是什么问题?

Any Idea what could be wrong?

推荐答案

更改此内容:

compile 'com.firebaseui:firebase-ui-auth:3.3.0'

对此:

compile 'com.firebaseui:firebase-ui-auth:4.0.0'

来自文档:

Library Version
firebase-auth   16.0.1
play-services-auth  15.0.1
firebase-database   16.0.1
firebase-firestore  17.0.1
firebase-storage    16.0.1

更多信息在这里:

https://github.com/firebase/FirebaseUI-Android#dependencies

这篇关于Firebase AuthUI:NoClassDefFoundError:无法解决以下问题:Lcom/google/android/gms/internal/zzbgl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 10:11