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
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?
Change this:
into this:
from the docs:
more info here:
https://github.com/firebase/FirebaseUI-Android#dependencies
I had same issue, after trying lots of things, this fixed this issue for me:
I modified my
build.gradle
on allProjects{} and added the followingsource here