Ben987654
Ben987654

Reputation: 3592

Android - Crashlytics doesn't log errors app wide, only activity it was initialized in

I've been having trouble with Crashlytics ever since I installed it into our app. I can't get it to report crashes app wide.

The initial install suggested we add the start command Fabric.with(this, new Crashlytics()); in the base application we had extended. When I put it here, it wouldn't report on any crash, anywhere in the app.

I then moved it to our sign in activity, and while it would report crashes I trigger there, it would not report in any other activity.

I've moved it to two other activities and I get the same results. It only reports where I initialize it, and only works if i initialize it once (I can't initialize it in each activity)

I emailed their support, and they basically said, that's not how it should behave, and that was essentially it, no suggestions or anything and I've received no further responses from them. How helpful.

I've used it before in my other apps and it works fine, so I'm at a loss as to what is going wrong here?

This is my gradle file

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

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.android.support:appcompat-v7:22.1.0'
    compile 'info.hoang8f:android-segmented:1.0.4'
    compile 'com.melnykov:floatingactionbutton:1.3.0'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
        transitive = true;
}

}
android {

defaultConfig {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"
}

productFlavors {

    flavorone{
        applicationId "ca.flavorone"
        manifestPlaceholders = xxxx

    }

    flavortwo{
        applicationId "ca.flavortwo"
        manifestPlaceholders = xxxx

    }
}

packagingOptions {
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/notice.txt'
    }
}

Upvotes: 2

Views: 2028

Answers (2)

Isaias M.
Isaias M.

Reputation: 11

What worked for me is initializing Fabric separately in the process e.g if your separate process has a service add this in your onCreate() method:

Fabric.with(this, new Crashlytics())

Upvotes: 0

Mike Bonnell
Mike Bonnell

Reputation: 16249

Mike from Fabric here - very odd to hear about your experience with our support team. The init should be in your application's subclass if you have onCreate() there. Are you using multiple processes or do you have any other exception handlers installed? If so, remove the other exception handlers and you'll be good to go!

Upvotes: 4

Related Questions