0

I've added firebase-core to my project for analytics but since then my app is not responding.

This is the class path for gms that I'm using :

classpath 'com.google.gms:google-services:3.1.0'

This is the dependency that I'm using for firebase :

compile 'com.google.firebase:firebase-core:11.0.1'

Also I've added apply plugin: 'com.google.gms.google-services' to bottom of my build gradle file.

And in my application class I'm just initializing the FirebaseAnalytics :

firebaseAnalytics = FirebaseAnalytics.getInstance(getApplicationContext());

And this is the error I got from the logcat :

E/AndroidRuntime: FATAL EXCEPTION: main
                                                               Process: com.PHELAT.Vollip, PID: 15670
                                                               java.lang.NoClassDefFoundError: com.google.android.gms.common.api.Status
                                                                   at com.google.android.gms.internal.zzbdl.<init>(Unknown Source)
                                                                   at com.google.android.gms.internal.zzbdl.zzaz(Unknown Source)
                                                                   at com.google.android.gms.internal.zzcff.zzjD(Unknown Source)
                                                                   at com.google.android.gms.internal.zzchi.initialize(Unknown Source)
                                                                   at com.google.android.gms.internal.zzcgk.<init>(Unknown Source)
                                                                   at com.google.android.gms.internal.zzcgk.zzbj(Unknown Source)
                                                                   at com.google.firebase.analytics.FirebaseAnalytics.getInstance(Unknown Source)
                                                                   at com.PHELAT.Vollip.Vollip.onCreate(Vollip.java:84)
                                                                   at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1025)
                                                                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5548)
                                                                   at android.app.ActivityThread.-wrap2(ActivityThread.java)
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                   at android.os.Looper.loop(Looper.java:241)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:6274)
                                                                   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)
                                                                Caused by: java.lang.InstantiationError: com.google.android.gms.common.api.zzf
                                                                   at com.google.android.gms.common.api.Status.<clinit>(Unknown Source)
                                                                   at com.google.android.gms.internal.zzbdl.<init>(Unknown Source)
                                                                   at com.google.android.gms.internal.zzbdl.zzaz(Unknown Source)
                                                                   at com.google.android.gms.internal.zzcff.zzjD(Unknown Source)
                                                                   at com.google.android.gms.internal.zzchi.initialize(Unknown Source)
                                                                   at com.google.android.gms.internal.zzcgk.<init>(Unknown Source)
                                                                   at com.google.android.gms.internal.zzcgk.zzbj(Unknown Source)
                                                                   at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at com.google.firebase.FirebaseApp.zza(Unknown Source)
                                                                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
                                                                   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                                                                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
                                                                   at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
                                                                   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                                   at android.app.ActivityThread.installProvider(ActivityThread.java:6008)
                                                                   at android.app.ActivityThread.installContentProviders(ActivityThread.java:5590)
                                                                   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5529)
                                                                   at android.app.ActivityThread.-wrap2(ActivityThread.java) 
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576) 
                                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                   at android.os.Looper.loop(Looper.java:241) 
                                                                   at android.app.ActivityThread.main(ActivityThread.java:6274) 

The error is pointing to line 84 of my application class which is the FirebaseAnalytics init.

Also, I did some research on this problem and I've found out that I need to enable multidex in my project, I've enabled multidexing but nothing changed.

Something that I've noticed is after adding firebase to my project, the apk size is reduced by 1mb and now I have two .dex classes in my apk, I think firebase is multidexing my app automatically but its not configured.

EDIT :

I'm switching back to fabric, I've just noticed that firebase is not working in Iran because of sanctions.

KENdi
  • 7,576
  • 2
  • 16
  • 31
Mahdi Nouri
  • 1,391
  • 14
  • 29
  • Look in your logcat at app startup for indications that MultiDex is correctly configured. You should see a few messages that contains "MultiDex", like this one: `I/MultiDex: install`. – Bob Snyder Jun 26 '17 at 15:43
  • 1
    I believe this question has already been answered. Please check https://stackoverflow.com/questions/33161671/java-lang-noclassdeffounderror-com-google-android-gms-internal-zzmp – Ashish Kumar Jun 27 '17 at 09:34

1 Answers1

0

use this version and try.

(Note: use same version for all gms and firebase library)

compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.android.gms:play-services-places:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-auth:9.6.1'
Jitendra
  • 3,608
  • 2
  • 17
  • 19