No virtual method verifyPhoneNumber, FATAL EXCEPTION: main

Viewed 2275

After updating the libraries into the Gradle file, I run into this error after trying to authenticate through the phone number.

--------- beginning of crash
2020-11-04 00:33:11.574 23042-23042/com.roko.hearth E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.roko.hearth, PID: 23042
java.lang.NoSuchMethodError: No virtual method verifyPhoneNumber(Ljava/lang/String;JLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/Executor;Lcom/google/firebase/auth/PhoneAuthProvider$OnVerificationStateChangedCallbacks;Lcom/google/firebase/auth/PhoneAuthProvider$ForceResendingToken;)V in class Lcom/google/firebase/auth/PhoneAuthProvider; or its super classes (declaration of 'com.google.firebase.auth.PhoneAuthProvider' appears in /data/app/com.roko.hearth-BB3VSAScHPWVlEGN0MD3dw==/base.apk!classes2.dex)
    at com.firebase.ui.auth.ui.phone.PhoneNumberVerificationHandler.verifyPhoneNumber(PhoneNumberVerificationHandler.java:32)
    at com.firebase.ui.auth.ui.phone.CheckPhoneNumberFragment.onNext(CheckPhoneNumberFragment.java:164)
    at com.firebase.ui.auth.ui.phone.CheckPhoneNumberFragment.onClick(CheckPhoneNumberFragment.java:140)
    at android.view.View.performClick(View.java:7140)
    at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:992)
    at android.view.View.performClickInternal(View.java:7117)
    at android.view.View.access$3500(View.java:801)
    at android.view.View$PerformClick.run(View.java:27351)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

I searched for a solution but the same problem

I have these libraries for the firebase into the Gradle

// Firebase
implementation platform('com.google.firebase:firebase-bom:26.0.0')
//Firebase Authentication
implementation 'com.google.firebase:firebase-auth'
implementation 'com.firebaseui:firebase-ui-auth:6.2.1'

//Firebase Database
implementation 'com.google.firebase:firebase-database'
implementation 'com.firebaseui:firebase-ui-database:6.2.1'

//Firebase Messaging
implementation 'com.google.firebase:firebase-messaging'

//Firebase Storage
implementation 'com.google.firebase:firebase-storage'

implementation 'com.google.firebase:firebase-perf'

implementation 'com.google.firebase:firebase-core'

/////////////////////////////////////////////////////////////////////////////

And the SHA-1 code is the same. Can someone help, please?

6 Answers
implementation platform('com.google.firebase:firebase-bom:26.1.0')
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.firebaseui:firebase-ui-auth:7.0.0'

this is the real correction ;)

I managed to resolve by downgrading firebase auth, and firebase auth-ui to:

implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.firebaseui:firebase-ui-auth:6.2.0'

then I removed:

// Firebase
implementation platform('com.google.firebase:firebase-bom:26.0.0')

So the gradle now looks like:

// Firebase
//Firebase Authentication
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.firebaseui:firebase-ui-auth:6.2.0'

//Firebase Database
implementation 'com.google.firebase:firebase-database:19.5.1'
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:6.4.0'

//Firebase Messaging
implementation 'com.google.firebase:firebase-messaging:21.0.0'

//Firebase Storage
implementation 'com.google.firebase:firebase-storage:19.2.0'

implementation 'com.google.firebase:firebase-perf:19.0.9'

implementation 'com.google.firebase:firebase-analytics:18.0.0'
//////////////////////////////////////////////////////////////////////

Somehow firebase performance is conflicting with firebase authentication. Everything now works as it should

Today, i had the same problem when i used the latest version of the Firebase Auth -'com.google.firebase:firebase-auth:20.0.0'. Then again i changed it to previous working version ('com.google.firebase:firebase-auth:19.4.0') and it started working again. Hope this is what you are looking for

If you are facing this problem in future please check the GitHub page of firebase UI. It always have the updated version of the library. If you dive a bit deep you will also find the related dependent libraries and update them as your project requirement.

Using just this line solved the problem for me.

implementation 'com.firebaseui:firebase-ui-auth:8.0.0'
Related