Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App crashes when i apply crashlytics on it

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)  
like image 204
Amir Jehangir Avatar asked Nov 14 '17 11:11

Amir Jehangir


People also ask

What happened to Crashlytics?

In January 2017, Crashlytics and Fabric were acquired by Google. In September 2018, Google announces that Fabric will be deprecated and developers should use Crashlytics via Firebase.

How Crashlytics works in Android?

Firebase Crashlytics is a lightweight, realtime crash reporter that helps you track, prioritize, and fix stability issues that erode your app quality. Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them.

Is Sentry better than Crashlytics?

"Crash tracking", "Mobile exception tracking" and "Free" are the key factors why developers consider Crashlytics; whereas "Consolidates similar errors and makes resolution easy", "Email Notifications" and "Open source" are the primary reasons why Sentry is favored.


2 Answers

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

like image 75
Alessandro Mautone Avatar answered Oct 10 '22 20:10

Alessandro Mautone


I have solved this problem by doing the following:

In the Application class:

@Override public void attachBaseContext(Context base) {     super.attachBaseContext(base);     try {         MultiDex.install(this);     } catch (RuntimeException multiDexException) {         multiDexException.printStackTrace();     } } 
like image 25
user2796148 Avatar answered Oct 10 '22 19:10

user2796148