12

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?

Erjon
  • 923
  • 2
  • 7
  • 32

6 Answers6

9
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 ;)

X6Entrepreneur
  • 971
  • 2
  • 10
  • 30
  • 1
    where does firebase-ui-auth include 7.0.0, I didn't get any source other than this – Aman Dec 03 '20 at 18:35
7

you just need to update firebaseUI to the latest version

implementation 'com.firebaseui:firebase-ui-auth:7.1.0' //or higher

it means if you use the latest firebase you need to use the latest firebaseUI as mentioned here https://github.com/firebase/FirebaseUI-Android/issues/1868

Omar
  • 71
  • 4
4

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

Erjon
  • 923
  • 2
  • 7
  • 32
4

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

Hriday Sarma
  • 139
  • 8
1

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.

Sayok Majumder
  • 1,012
  • 13
  • 28
0

Using just this line solved the problem for me.

implementation 'com.firebaseui:firebase-ui-auth:8.0.0'
nyxee
  • 2,773
  • 26
  • 22