Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError: No virtual method setTokenProvider

Below error occurs whenever i add com.google.firebase:firebase-firestore:19.0.0 to the Gradle and run the app.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: meter.meter, PID: 13588
    java.lang.NoSuchMethodError: No virtual method setTokenProvider(Lcom/google/firebase/internal/InternalTokenProvider;)V in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/meter.meter-Qosf8nECYGfI4HI93CwJrw==/split_lib_dependencies_apk.apk!classes2.dex)
        at com.google.firebase.auth.zzp.create(Unknown Source:4)
        at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-common@@17.0.0:66)
        at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
        at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-common@@17.0.0:53)
        at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-common@@17.0.0:155)
        at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@17.0.0:642)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:358)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:321)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.0.0:305)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.0.0:53)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.0.0:47)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        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:858)

Gradle:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

    implementation 'com.firebaseui:firebase-ui-auth:4.3.1'


    implementation 'com.facebook.android:facebook-android-sdk:5.0.0'

    implementation 'com.twitter.sdk.android:twitter-core:3.3.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'

    implementation 'com.github.yalantis:ucrop:2.2.3-native'

    def camerax_version = "1.0.0-alpha01"
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"

    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.google.firebase:firebase-firestore:19.0.0'


}
apply plugin: 'com.google.gms.google-services'
like image 416
VINNUSAURUS Avatar asked May 12 '19 13:05

VINNUSAURUS


1 Answers

Since you are using the latest version of firestore then, you need to add the following dependency to your build.gradle:

implementation 'com.google.firebase:firebase-auth:17.0.0'

According to the docs:

Authentication version 17.0.0

This update of firebase-auth is required to use new versions of firebase-firestore, firebase-functions, firebase-storage, and firebase-database going forward.

Also since firebase-ui-auth uses version 16.0.5 of firebase auth then adding your own firebase-auth implementation which will override that version.


So you should have the following dependencies:

dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar'])
 implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
 testImplementation 'junit:junit:4.12'
 androidTestImplementation 'androidx.test:runner:1.1.0'
 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

 implementation 'com.google.firebase:firebase-auth:17.0.0'
 implementation 'com.firebaseui:firebase-ui-auth:4.3.1'



 implementation 'com.facebook.android:facebook-android-sdk:5.0.0'

 implementation 'com.twitter.sdk.android:twitter-core:3.3.0'
 implementation 'androidx.recyclerview:recyclerview:1.0.0'

 implementation 'com.github.yalantis:ucrop:2.2.3-native'

 def camerax_version = "1.0.0-alpha01"
 implementation "androidx.camera:camera-core:${camerax_version}"
 implementation "androidx.camera:camera-camera2:${camerax_version}"

 implementation 'de.hdodenhof:circleimageview:3.0.0'
 implementation 'com.google.firebase:firebase-firestore:19.0.0'


}
like image 152
Peter Haddad Avatar answered Oct 18 '22 09:10

Peter Haddad