I'm trying to integrate firebase notification to existing android application. But when the app start it crashes.
Process: uk.co.stableweb.geethika, PID: 24344
java.lang.IncompatibleClassChangeError: com.google.firebase.auth.FirebaseAuth
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
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.zzeh(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5233)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4828)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4768)
at android.app.ActivityThread.access$1600(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5497)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-18 10:47:24.284 24344-24344/uk.co.stableweb.geethika D/AppTracker: App Event: crash
This is app.grade.
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-database:9.2.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.firebaseui:firebase-ui:0.4.1'
compile 'com.firebaseui:firebase-ui-database:0.4.1'
compile 'com.firebaseui:firebase-ui-auth:0.4.1'
compile 'org.sufficientlysecure:html-textview:1.6'
compile 'com.android.support:support-v4:23.4.0'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.google.firebase:firebase-messaging:9.2.1'
In another question in stackoverflow, someone suggested to enable authentication. Even though I don't use authentication, I enabled anonymous option.
And I updated google repository and play services in both device and SDK. If you have any idea on how to solve this it would be great. Thank you!
Firebase SDK requires all the libraries to be at the same version.
if you are using
com.google.firebase:firebase-core:9.2.0
then you needcom.google.firebase:firebase-messaging:9.2.0
The error seems to be caused by
firebase-auth
library being on a different version thanfirebase-core
. But you don't have firebase-auth in your gradle file, which is strange.It's possible that some other library you are depending on, are importing firebase-auth with a different version than your firebase-core import.
Check this with the following command: