Home » Android » signOut method (from Firebase Authentication) stops my app

signOut method (from Firebase Authentication) stops my app

Posted by: admin November 1, 2017 Leave a comment

Questions:

I add Firebase Authentication to my app. I build the APK without problems. I run the app on the emulator and when I press the signOut button the app stops working.
The debugger shows this:

10-22 17:56:30.246 2540-2540/com.doov.prototype E/AndroidRuntime: FATAL EXCEPTION: main
                                                                  Process: com.doov.prototype, PID: 2540
                                                                  java.lang.IncompatibleClassChangeError: Superclass com.google.android.gms.internal.zzbax of com.google.android.gms.internal.zzarm is an interface (declaration of 'com.google.android.gms.internal.zzarm' appears in /data/app/com.doov.prototype-EkSA0Y-MCxsGwYGtmSxRQQ==/split_lib_dependencies_apk.apk:classes33.dex)
                                                                      at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:95)
                                                                      at com.firebase.ui.auth.util.GoogleSignInHelper.getInstance(GoogleSignInHelper.java:21)
                                                                      at com.firebase.ui.auth.AuthUI.signOut(AuthUI.java:175)
                                                                      at com.doov.prototype.SignedInActivity.signOut(SignedInActivity.java:38)
                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                      at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
                                                                      at android.view.View.performClick(View.java:6256)
                                                                      at android.view.View$PerformClick.run(View.java:24701)
                                                                      at android.os.Handler.handleCallback(Handler.java:789)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                      at android.os.Looper.loop(Looper.java:164)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
10-22 17:56:30.251 2540-2540/com.doov.prototype E/UncaughtException: java.lang.IncompatibleClassChangeError: Superclass com.google.android.gms.internal.zzbax of com.google.android.gms.internal.zzarm is an interface (declaration of 'com.google.android.gms.internal.zzarm' appears in /data/app/com.doov.prototype-EkSA0Y-MCxsGwYGtmSxRQQ==/split_lib_dependencies_apk.apk:classes33.dex)
                                                                         at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:95)
                                                                         at com.firebase.ui.auth.util.GoogleSignInHelper.getInstance(GoogleSignInHelper.java:21)
                                                                         at com.firebase.ui.auth.AuthUI.signOut(AuthUI.java:175)
                                                                         at com.doov.prototype.SignedInActivity.signOut(SignedInActivity.java:38)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
                                                                         at android.view.View.performClick(View.java:6256)
                                                                         at android.view.View$PerformClick.run(View.java:24701)
                                                                         at android.os.Handler.handleCallback(Handler.java:789)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                         at android.os.Looper.loop(Looper.java:164)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

I’m new to programming, so I don´t understand clearly how to debug. Any tips? Thanks in advance.

Here are the build.gradle dependencies:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.firebaseui:firebase-ui:2.0.1'
    compile 'com.firebaseui:firebase-ui-auth:2.0.1'
    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'com.google.firebase:firebase-database:10.0.1'
    testCompile 'junit:junit:4.12'
}
Answers:

According to:

https://github.com/firebase/FirebaseUI-Android/issues/798

It looks like you are missing a dependency. Please add the com.google.android.gms:play-services-auth since it’s required by Firebase’s authentication system.

So, to be short, add this line in your build.gradle:

compile "com.google.android.gms:play-services-auth:11.0.4"

Also check the values of the other dependencies, and make them fit according to these versions:

https://github.com/firebase/FirebaseUI-Android#upgrading-dependencies

Google uses to obfuscate their libraries, and this causes problems if the versions of your dependencies do not match.