firebase / quickstart-android

Firebase Quickstart Samples for Android
https://firebase.google.com
Apache License 2.0
8.88k stars 7.33k forks source link

Latest Firestore Quickstart encounters NoClassDefFoundError: CredentialsOptions$Builder #1647

Open argzdev opened 3 months ago

argzdev commented 3 months ago

Step 1: Describe your environment

Step 2: Describe the problem:

Steps to reproduce:

  1. Download Quickstart
  2. Run Firestore

Observed Results:

2024-08-05 19:12:58.712  7297-7297  AndroidRuntime          com...gle.firebase.example.fireeats  E  FATAL EXCEPTION: main
                                                                                                    Process: com.google.firebase.example.fireeats, PID: 7297
                                                                                                    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/credentials/CredentialsOptions$Builder;
                                                                                                        at com.firebase.ui.auth.util.GoogleApiUtils.getCredentialsClient(GoogleApiUtils.java:29)
                                                                                                        at com.firebase.ui.auth.viewmodel.AuthViewModelBase.onCreate(AuthViewModelBase.java:30)
                                                                                                        at com.firebase.ui.auth.viewmodel.ViewModelBase.init(ViewModelBase.java:24)
                                                                                                        at com.firebase.ui.auth.KickoffActivity.onCreate(KickoffActivity.java:38)
                                                                                                        at android.app.Activity.performCreate(Activity.java:8000)
                                                                                                        at android.app.Activity.performCreate(Activity.java:7984)
                                                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
                                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
                                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
                                                                                                        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
                                                                                                        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
                                                                                                        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                        at android.os.Looper.loop(Looper.java:223)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7656)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
                                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.credentials.CredentialsOptions$Builder" on path: DexPathList[[zip file "/data/app/~~jxILtii72sMxj9gULZghyg==/com.google.firebase.example.fireeats-HCrLOYixLfszxtdVOEXyiw==/base.apk"],nativeLibraryDirectories=[/data/app/~~jxILtii72sMxj9gULZghyg==/com.google.firebase.example.fireeats-HCrLOYixLfszxtdVOEXyiw==/lib/x86, /system/lib, /system_ext/lib]]
                                                                                                        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                                                        at com.firebase.ui.auth.util.GoogleApiUtils.getCredentialsClient(GoogleApiUtils.java:29) 
                                                                                                        at com.firebase.ui.auth.viewmodel.AuthViewModelBase.onCreate(AuthViewModelBase.java:30) 
                                                                                                        at com.firebase.ui.auth.viewmodel.ViewModelBase.init(ViewModelBase.java:24) 
                                                                                                        at com.firebase.ui.auth.KickoffActivity.onCreate(KickoffActivity.java:38) 
                                                                                                        at android.app.Activity.performCreate(Activity.java:8000) 
                                                                                                        at android.app.Activity.performCreate(Activity.java:7984) 
                                                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) 
                                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422) 
                                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) 
                                                                                                        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
                                                                                                        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
                                                                                                        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                        at android.os.Looper.loop(Looper.java:223) 
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7656) 
                                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

Expected Results:

Relevant Information:

According to this Stack Overflow thread,com.google.android.gms:play-services-auth of version 21.2.0 no longer uses Credentials API. Mitigation for now is downgrading to version 20.7.0.

thatfiredev commented 3 months ago

@argzdev Thanks for reporting this. The Firestore quickstart uses the Firebase UI library, which has a bug that I haven't been able to prioritize 😓 : https://github.com/firebase/FirebaseUI-Android/issues/2158

Mitigation for now is downgrading to version 20.7.0.

Would you like to send a PR pinning the version in this quickstart as a temporary fix for now? We can remove the pinned verison once that bug is fixed.

argzdev commented 2 months ago

Hey @thatfiredev, totally missed your reply! @lehcar09 will do the honors for the PR.