My app was working.
I updated all my play services to 9.0.0, applied the 'com.google.gms.google-services'
plugin, and the 'com.google.gms:google-services:3.0.0'
classpath.
Now my app is crashing and throwing this error:
/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/fasterxml/jackson/databind/ObjectMapper;
at com.firebase.client.core.view.QueryParams.<clinit>(QueryParams.java:36)
at com.firebase.client.Firebase.<init>(Firebase.java:172)
at com.firebase.client.Firebase.<init>(Firebase.java:177)
at com.firebase.client.Firebase.<init>(Firebase.java:155)
at com.defaultPackage.Application.addListener(Application.java:324)
at com.defaultPackage.Application.onCreate(Application.java:84)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.fasterxml.jackson.databind.ObjectMapper" on path: DexPathList[[zip file "/data/app/com.defaultPackage-2/base.apk"],nativeLibraryDirectories=[/data/app/com.defaultPackage-2/lib/arm, /vendor/lib, /system/lib]]
I saw this question but the answer provided there did not solve the error for me.
Does anyone know what is causing it?
Update:
My original answer can solve the issue, but upon upgrading to the new Firebase SDK I was required to apply the plugin 'com.google.gms.google-services'
but as I was already compiling 'com.google.android.gms:play-services:version'
this caused some kind of conflict, and by removing the compiled play-services library from my app build.gradle the issue was fixed and my productFlavours no-longer needed to be removed
Original answer:
Leaving the Firebase SDK code 100% unmodified will in some cases let the old Firebase SDK function as it used to when you update to the new Firebase SDK. But, in my case despite leaving my code 100% the same as it was the java.lang.NoClassDefFoundError was being thrown.
The issue was caused by applying the line 'apply plugin: 'com.google.gms.google-services'
to my app level build.gradle, the line 'classpath 'com.google.gms:google-services:3.0.0'
to my project level build.gradle and the google-services file to the project and updating to google play services to 9.0.0
The update caused the java.lang.NoClassDefFoundError to be thrown by the Facebook Rebound library as well as the old Firebase SDK.
My project is a multidex project and in my app level build.gradle I had the lines:
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 14
}
}
By commenting out or removing these lines the java.lang.NoClassDefFoundError was no longer thrown by the old Firebase SDK or the Facebook Rebound library.