App crashes when i apply crashlytics on it

Amir Jehangir picture Amir Jehangir · Nov 14, 2017 · Viewed 10.4k times · Source

App crashes when i apply crashlytics on it

FATAL EXCEPTION: main

Process: com.ehs.pk, PID: 20963
java.lang.RuntimeException: Unable to get provider com.crashlytics.android.CrashlyticsInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.crashlytics.android.CrashlyticsInitProvider" on path: DexPathList[[zip file "/data/app/com.ehs.pk-8.apk"],nativeLibraryDirectories=[/data/app-lib/com.ehs.pk-8, /vendor/lib, /system/lib]]
    at android.app.ActivityThread.installProvider(ActivityThread.java:4993)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4585)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4499)
    at android.app.ActivityThread.access$1500(ActivityThread.java:157)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:157)
    at android.app.ActivityThread.main(ActivityThread.java:5293)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.crashlytics.android.CrashlyticsInitProvider" on path: DexPathList[[zip file "/data/app/com.ehs.pk-8.apk"],nativeLibraryDirectories=[/data/app-lib/com.ehs.pk-8, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    at android.app.ActivityThread.installProvider(ActivityThread.java:4978)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4585) 
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4499) 
    at android.app.ActivityThread.access$1500(ActivityThread.java:157) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:157) 
    at android.app.ActivityThread.main(ActivityThread.java:5293) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:515) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 
    at dalvik.system.NativeStart.main(Native Method) 

Answer

Alessandro Mautone picture Alessandro Mautone · Dec 20, 2017

I was facing the same issue, is related to the 64k limit "multidex".

I was using multiDexEnabled true property in build.gradle in defaultConfig block, under android one.

As stated in Google documentation

for devices with Android API prior to 21, we need to include the multidex library (implementation 'com.android.support:multidex:1.0.2')

and extend MultiDexApplication in our Application class