1
votes

I am encountering this error when running my app in an emulator from Android Studio. The app compiles successfully.

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/~~_7zL9Id2RK7b6zEuTNlmiQ==/com.example.abc_supermarket-2V5eMXxz7SuahQK49NOpSw==/base.apk)

My Gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.abc_supermarket"
        minSdkVersion 14
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
    implementation 'com.google.firebase:firebase-database:19.5.0'
    implementation 'com.google.firebase:firebase-storage:19.2.0'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'


// For Card view
    implementation 'androidx.cardview:cardview:1.0.0'

// Chart and graph library
    implementation 'com.github.blackfizz:eazegraph:1.2.5l@aar'
    implementation 'com.nineoldandroids:library:2.4.0'

    repositories {
        maven { url 'https://jitpack.io' }
    }

    dependencies {
        implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    }

    android {
        lintOptions {
            checkReleaseBuilds false
            // Or, if you prefer, you can continue to check for errors in release builds,
            // but continue the build even when errors are found:
            abortOnError false
        }
    }


}

The error only started occurring after I added Firebase Storage to my app. I have found only one other post about this error on SO and the only solution provided did not work for me. There doesn't seem to be much information about this particular error online so I am coming here in desperate need of help. All responses are greatly appreciated :)

PS. I am still quite new to working with Android Studio

1

1 Answers

0
votes

Maybe it's because you're using old firebase auth and latest firebase storage and Firebase release notes provided details :

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

Breaking changes for this update:

  • If you use Firebase Authentication, update to firebase-auth v17.0.0 or later to ensure functionality alignment with other updated Firebase libraries.
  • Several libraries updated minSdkVersion to API level 16 to align with the Google Play services distribution policy.
  • In your project-level build.gradle file, make sure to include Google's Maven repository in both your buildscript and allprojects sections.

Just change it to new version of firebase auth