Fabric/Crashlytics NoClassDefFoundError only on certain devices

codeman picture codeman · Aug 19, 2015 · Viewed 13.6k times · Source

I'm seeing a crash in Google Play related to Fabric/Crashlytics. This happened after I updated from normal Crashlytics to the new Fabric Crashlytics. I can only reproduce it on one of my devices (Galaxy S2). All other devices that I have (Nexus 5 and S4) do not have the crash. Here's the stack trace:

08-19 09:32:26.328    7084-7084/com.tsm.countryjam D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 0ms
08-19 09:32:26.653    7084-7088/com.tsm.countryjam D/dalvikvm﹕ GC_CONCURRENT freed 251K, 12% free 9567K/10823K, paused 12ms+2ms, total 70ms
08-19 09:32:26.653    7084-7084/com.tsm.countryjam D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 42ms
08-19 09:32:26.653    7084-7100/com.tsm.countryjam D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 42ms
08-19 09:32:26.668    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Failed resolving Lcom/crashlytics/android/beta/Beta; interface 9027 'Lio/fabric/sdk/android/services/common/DeviceIdentifierProvider;'
08-19 09:32:26.668    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Link of class 'Lcom/crashlytics/android/beta/Beta;' failed
08-19 09:32:26.668    7084-7084/com.tsm.countryjam E/dalvikvm﹕ Could not find class 'com.crashlytics.android.beta.Beta', referenced from method com.crashlytics.android.Crashlytics.<init>
08-19 09:32:26.668    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve new-instance 1791 (Lcom/crashlytics/android/beta/Beta;) in Lcom/crashlytics/android/Crashlytics;
08-19 09:32:26.668    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x000a
08-19 09:32:26.668    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Failed resolving Lcom/crashlytics/android/beta/Beta; interface 9027 'Lio/fabric/sdk/android/services/common/DeviceIdentifierProvider;'
08-19 09:32:26.668    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Link of class 'Lcom/crashlytics/android/beta/Beta;' failed
08-19 09:32:26.668    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to find class referenced in signature (Lcom/crashlytics/android/beta/Beta;)
08-19 09:32:26.673    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Failed resolving Lcom/crashlytics/android/beta/Beta; interface 9027 'Lio/fabric/sdk/android/services/common/DeviceIdentifierProvider;'
08-19 09:32:26.673    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Link of class 'Lcom/crashlytics/android/beta/Beta;' failed
08-19 09:32:26.673    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to find class referenced in signature (Lcom/crashlytics/android/core/PinningInfoProvider;)
08-19 09:32:26.673    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to find class referenced in signature (Lcom/crashlytics/android/core/PinningInfoProvider;)
08-19 09:32:26.673    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to find class referenced in signature (Lcom/crashlytics/android/core/PinningInfoProvider;)
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to find class referenced in signature (Lcom/crashlytics/android/core/CrashlyticsListener;)
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to find class referenced in signature (Lcom/crashlytics/android/core/CrashlyticsListener;)
08-19 09:32:26.678    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Failed resolving Lcom/crashlytics/android/beta/Beta; interface 9027 'Lio/fabric/sdk/android/services/common/DeviceIdentifierProvider;'
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Link of class 'Lcom/crashlytics/android/beta/Beta;' failed
08-19 09:32:26.678    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0x3474 at 0x0f in Lcom/crashlytics/android/Crashlytics;.<init>
08-19 09:32:26.678    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Failed resolving Lcom/crashlytics/android/answers/SessionEventTransform; interface 9072 'Lio/fabric/sdk/android/services/events/EventTransform;'
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Link of class 'Lcom/crashlytics/android/answers/SessionEventTransform;' failed
08-19 09:32:26.678    7084-7084/com.tsm.countryjam E/dalvikvm﹕ Could not find class 'com.crashlytics.android.answers.SessionEventTransform', referenced from method com.crashlytics.android.answers.Answers.initializeSessionAnalytics
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve new-instance 1784 (Lcom/crashlytics/android/answers/SessionEventTransform;) in Lcom/crashlytics/android/answers/Answers;
08-19 09:32:26.678    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0004
08-19 09:32:26.678    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Could not find method io.fabric.sdk.android.services.common.CommonUtils.logControlledError, referenced from method com.crashlytics.android.answers.Answers.initializeSessionAnalytics
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve static method 59049: Lio/fabric/sdk/android/services/common/CommonUtils;.logControlledError (Landroid/content/Context;Ljava/lang/String;Ljava/lang/Throwable;)V
08-19 09:32:26.678    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x77 at 0x0194
08-19 09:32:26.678    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Could not find method io.fabric.sdk.android.services.settings.Settings.getInstance, referenced from method com.crashlytics.android.answers.Answers.doInBackground
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve static method 59331: Lio/fabric/sdk/android/services/settings/Settings;.getInstance ()Lio/fabric/sdk/android/services/settings/Settings;
08-19 09:32:26.678    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x000c
08-19 09:32:26.678    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Could not find method io.fabric.sdk.android.services.common.CommonUtils.getStringsFileValue, referenced from method com.crashlytics.android.answers.Answers.getOverridenSpiEndpoint
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve static method 59043: Lio/fabric/sdk/android/services/common/CommonUtils;.getStringsFileValue (Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
08-19 09:32:26.678    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0008
08-19 09:32:26.678    7084-7084/com.tsm.countryjam E/dalvikvm﹕ Could not find class 'io.fabric.sdk.android.services.persistence.FileStoreImpl', referenced from method com.crashlytics.android.answers.Answers.getSdkDirectory
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve new-instance 9090 (Lio/fabric/sdk/android/services/persistence/FileStoreImpl;) in Lcom/crashlytics/android/answers/Answers;
08-19 09:32:26.678    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0001
08-19 09:32:26.678    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Could not find method io.fabric.sdk.android.services.common.Crash$FatalException.getSessionId, referenced from method com.crashlytics.android.answers.Answers.onException
08-19 09:32:26.678    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve virtual method 59056: Lio/fabric/sdk/android/services/common/Crash$FatalException;.getSessionId ()Ljava/lang/String;
08-19 09:32:26.678    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000b
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Could not find method io.fabric.sdk.android.services.common.Crash$LoggedException.getSessionId, referenced from method com.crashlytics.android.answers.Answers.onException
08-19 09:32:26.683    7084-7084/com.tsm.countryjam W/dalvikvm﹕ VFY: unable to resolve virtual method 59058: Lio/fabric/sdk/android/services/common/Crash$LoggedException;.getSessionId ()Ljava/lang/String;
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000b
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ Failed resolving Lcom/crashlytics/android/answers/SessionEventTransform; interface 9072 'Lio/fabric/sdk/android/services/events/EventTransform;'
08-19 09:32:26.683    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Link of class 'Lcom/crashlytics/android/answers/SessionEventTransform;' failed
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0x3455 at 0x0c in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0xe6da at 0x19 in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0xe78c at 0x36 in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Unable to resolve superclass of Lcom/crashlytics/android/answers/SessionAnalyticsFilesManager; (9073)
08-19 09:32:26.683    7084-7084/com.tsm.countryjam W/dalvikvm﹕ Link of class 'Lcom/crashlytics/android/answers/SessionAnalyticsFilesManager;' failed
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0x342a at 0x4b in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x5e1e at 0x72 in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x5e1c at 0x7e in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x5e21 at 0x8a in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0xe78f at 0x115 in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0xe78f at 0x17d in Lcom/crashlytics/android/answers/Answers;.initializeSessionAnalytics
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ DexOpt: unable to optimize instance field ref 0x5e91 at 0x20 in Lcom/crashlytics/android/answers/Answers;.doInBackground
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ DexOpt: unable to optimize instance field ref 0x5e8c at 0x22 in Lcom/crashlytics/android/answers/Answers;.doInBackground
08-19 09:32:26.683    7084-7084/com.tsm.countryjam I/dalvikvm﹕ DexOpt: unable to optimize instance field ref 0x5e8e at 0x2a in Lcom/crashlytics/android/answers/Answers;.doInBackground
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/dalvikvm﹕ DexOpt: unable to opt direct call 0xe7ac at 0x07 in Lcom/crashlytics/android/answers/Answers;.getSdkDirectory
08-19 09:32:26.683    7084-7084/com.tsm.countryjam D/AndroidRuntime﹕ Shutting down VM
08-19 09:32:26.683    7084-7084/com.tsm.countryjam W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4127b2a0)
08-19 09:32:26.683    7084-7084/com.tsm.countryjam E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: com.crashlytics.android.beta.Beta
            at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
            at com.tsm.events.application.TownsquareEvents.onCreate(TownsquareEvents.java:59)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4251)
            at android.app.ActivityThread.access$1400(ActivityThread.java:140)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4921)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
            at dalvik.system.NativeStart.main(Native Method)

And here's the contents of my build.gradle:

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

    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.+'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    jcenter()
    flatDir {
        dirs 'libs'
    }
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.tsm.events"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0.0"
        multiDexEnabled = true
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        debug {
            debuggable true
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libraries:ResideMenu')
    //compile 'com.android.support:support-v4:20.0.+'
    compile 'com.android.support:support-v4:22.0.+'
    compile files('libs/universal-image-loader-1.9.3.jar')
    compile 'io.realm:realm-android:0.81.1'
    compile 'se.emilsjolander:stickylistheaders:2.5.2'
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
        transitive = true
    }
    // Twitter Kit
    compile('com.twitter.sdk.android:twitter:1.6.0@aar') {
        transitive = true
    }
    compile('com.twitter.sdk.android:tweet-composer:0.8.0@aar') {
        transitive = true;
    }
    compile 'com.facebook.android:facebook-android-sdk:3.20.0'
    compile 'com.google.maps.android:android-maps-utils:0.3+'
    compile(name: 'estimote-sdk-preview', ext: 'aar')
    compile files('libs/biweekly-0.4.2.jar')
    compile files('libs/jackson-core-2.5.2.jar')
}

Answer

codeman picture codeman · Aug 19, 2015

I just figured it out with a hunch! I recently had to add multi-dex support after upgrading to the new Fabric framework, and I had a feeling that maybe I didn't do it correctly. So after adding these additional changes, now it no longer crashes:

In my build.gradle, I added an incremental settings:

dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }

and an additional dependency:

compile 'com.android.support:multidex:'

and on my application class I'm extending MultiDexApplication:

public class TownsquareEvents extends android.support.multidex.MultiDexApplication