Ian Fako
Ian Fako

Reputation: 1210

Android app crashing after adding Firebase Analytics

I've added Firebase Analytics to my Android app. I followed these steps. Already searched for reasons, but all I found so far is that my firebase libraries aren't the same version, which is not the case:

From build.gradle

dependencies {
    compile 'com.google.firebase:firebase-core:9.2.0'
    compile 'com.google.firebase:firebase-database:9.2.0'
    compile 'com.google.firebase:firebase-auth:9.2.0'
    compile 'com.google.firebase:firebase-analytics:9.2.0'
    compile 'com.firebaseui:firebase-ui:0.4.4'
    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.1'
    compile 'com.android.support:design:25.1.1'
    testCompile 'junit:junit:4.12'
}

The exception I get when launching the app: (replaced the projectname with [project] here)

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: [project], PID: 2764
              java.lang.NoSuchMethodError: No static method zzaa(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzab; or its super classes (declaration of 'com.google.android.gms.common.internal.zzab' appears in /data/data/[project]/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-9.4.0_6f4892c05c33d659d842b5c84c264bd97b467134-classes.dex)
                  at com.google.android.gms.measurement.internal.zzx.zzdo(Unknown Source)
                  at com.google.firebase.analytics.FirebaseAnalytics.getInstance(Unknown Source)
                  at [project].MainActivity.onCreate(MainActivity.java:65)
                  at android.app.Activity.performCreate(Activity.java:6662)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                  at android.app.ActivityThread.-wrap12(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:154)
                  at android.app.ActivityThread.main(ActivityThread.java:6077)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Upvotes: 1

Views: 1233

Answers (2)

Angelo Parente
Angelo Parente

Reputation: 818

One problem could be that you are using compile 'com.firebaseui:firebase-ui:0.4.4' but using version 9.2.0 of firebase.

According to firebase-ui page here link with firebase 9.2.0 you should use version 0.4.2 of firebase ui.

Upvotes: 1

Dus
Dus

Reputation: 4240

Do you have more dependencies on your gradle ? It looks like you're using com.google.android.gms-play-services-basement-9.4.0 which causing the error...

Align the libraries to the same version, 9.2.0 or 9.4.0 (or maybe upgrade to the most recent version)

Upvotes: 0

Related Questions