Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Fabric crashlytics causing app crash

I am getting a strange crash due to Fabric Crashlytics. I am using fabric's crashlytics. But When I run app on S5 5.0 API 21, it crashes the whole application.

See the report below:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/crashlytics/android/core/CrashlyticsCore;
                                                                    at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
                                                                    at com.projectname.application.AppData.onCreate(AppData.java:162)
                                                                    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
                                                                    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010)
                                                                    at android.app.ActivityThread.access$1600(ActivityThread.java:172)
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                    at android.os.Looper.loop(Looper.java:145)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:5835)
                                                                    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:1399)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
                                                                 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.crashlytics.android.core.CrashlyticsCore" on path: DexPathList[[zip file "/data/app/com.projectname-2/base.apk", zip file "/data/app/com.projectname-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.packagename-here-2/lib/arm, /vendor/lib, /system/lib]]
                                                                    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                    at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29) 
                                                                    at com.packagename--here.application.AppData.onCreate(AppData.java:162) 
                                                                    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020) 
                                                                    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010) 
                                                                    at android.app.ActivityThread.access$1600(ActivityThread.java:172) 
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:145) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:5835) 
                                                                    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:1399) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) 
                                                                    Suppressed: java.lang.ClassNotFoundException: com.crashlytics.android.core.CrashlyticsCore
                                                                    at java.lang.Class.classForName(Native Method)
                                                                    at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                    at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                            ... 14 more
                                                                 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Here is my gradle file:

 buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
repositories {
    maven {
        url "https://jitpack.io"
        maven { url 'https://github.com/500px/500px-android-blur/raw/master/releases/' }
    }
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'


repositories {
    maven { url 'https://maven.fabric.io/public' }
}



apply plugin: 'android-apt'
android {
    lintOptions {
        disable 'MissingTranslation'
        checkReleaseBuilds false
    }
    packagingOptions {
        exclude 'META-INF/rxjava.properties'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId "--package--name"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 23
        versionName "2.6"
        multiDexEnabled true
    }

    buildTypes {
        release {

            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {


        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.1'

    compile 'com.jakewharton:butterknife:8.4.0'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    // retrofit, gson
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.2.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.github.angads25:filepicker:1.0.6'
    compile 'io.reactivex:rxjava:1.0.16'
    // Progress loader
    compile 'com.wang.avi:library:2.1.3'
    //Stetho debug
    compile 'com.facebook.stetho:stetho:1.4.2'
    //Stetho OkHttp3
    //compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
    compile project(':facebook-android-sdk-4.16.1')
    compile project(':linkedin-sdk')
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    compile 'com.google.android.gms:play-services:9.8.0'
    // image picker
    compile 'com.github.darsh2:MultipleImageSelect:3474549'
    // instabug
    compile 'com.instabug.library:instabug:3+'
    compile 'com.github.recruit-lifestyle:WaveSwipeRefreshLayout:1.6'
    compile 'com.facebook.fresco:fresco:1.3.0'
    compile 'com.borjabravo:readmoretextview:2.0.1'
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    // Because RxAndroid releases are few and far between, it is recommended you also
    // explicitly depend on RxJava's latest version for bug fixes and new features.
    compile 'io.reactivex.rxjava2:rxjava:2.0.1'
    compile project(':versioninfo')
}


apply plugin: 'com.google.gms.google-services'

App is crashing whenever launched.
I have also tried multidex but still there is some issue.

like image 599
Akshay Sood Avatar asked Aug 21 '17 11:08

Akshay Sood


People also ask

How do I disable Crashlytics?

Here's a couple of ways to disable Crashlytics while you are doing your debug builds! Use a different android:versionString for debug and release builds and then disable crash reporting from the Crashlytics web dashboard for the debug version. Wrap the call to Crashlytics.

Why Crashlytics is integrated with your app?

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 Crashlytics deprecated?

Fabric Crashlytics deprecated, upgrade to Firebase Crashlytics before November 15 to keep receiving reports. So, as it was announced, Fabric is no longer available from today and now we'll have to use Firebase instead.


1 Answers

This kind of errors are usually related to the MultiDex usage

take a look at your code and verify that (especially point 2):

1) you have added the multidex support to your app:

compile 'com.android.support:multidex:1.0.1'

2) You have set your application as a MultiDex Application

public class MyApplication extends Application {

    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    // Your application implementation here
}

3) you have added multiDexEnabled true setting to your build.gradle file:

defaultConfig {
    // Other settings here
    multiDexEnabled true
} 
like image 158
cristallo Avatar answered Oct 11 '22 10:10

cristallo