Search code examples
androidfirebasegradlefirebase-authenticationnosuchmethoderror

FirebaseAuth - Compat problems (java.lang.NoSuchMethodError: No virtual method zzUV())


I have an android project that keeps crashing on startup since I added: firebase auth.

What I've done :

  1. Added the google-services.json to the app level folder

  2. Added classpath 'com.google.gms:google-services:3.0.0' in build.gradle (top level)

  3. And here is my build.gradle content (app level)

here it goes:

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "xxxx.xxx.xxx"
    minSdkVersion 21
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    jackOptions {
        enabled true
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
    debug {
        debuggable true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
 }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
  compile 'com.android.support:appcompat-v7:25.1.0'
  compile 'com.android.support:design:25.1.0'
  compile 'com.android.support:support-v4:25.1.0'
  compile 'com.google.android.gms:play-services-base:10.2.1'
  compile 'com.google.android.gms:play-services-maps:10.2.1'
  compile 'com.google.android.gms:play-services-location:10.2.1'
  compile 'com.google.firebase:firebase-auth:10.2.1'
  compile 'com.android.support:recyclerview-v7:25.1.0'
  compile 'com.android.support:cardview-v7:25.1.0'
  testCompile 'junit:junit:4.12'
}

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

Here is the stacktrace when it crashes:

FATAL EXCEPTION: main Process: xxx.xxxx, PID: 8425

java.lang.NoSuchMethodError: No virtual method zzUV()Ljava/lang/String; in 
class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 
'com.google.firebase.FirebaseApp' appears in /data/app/xxx.xxx-2/base.apk)
at com.google.firebase.auth.FirebaseAuth.zzd(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.zzc(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at xxx.xxxx.LoginActivity.onCreate(LoginActivity.java:82)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Solution

  • In my case, the problem was that my google play service sdk was not installed in android studio. After installing it, I cleaned the project and everything worked.