Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crashlytics not showing crashes for release build Android

I am facing isssue with Crashlytics. Not sure what I am doing wrong. I have two buildTypes release and debug as below. Gradle file:

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

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

apply plugin: 'android-apt'
def AAVersion = '4.2.0'

buildscript {
  repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
  }
  dependencies {
    // replace with the current version of the android-apt plugin
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    classpath 'io.fabric.tools:gradle:1.+'
  }
}

apt {
   arguments {
    // you should set your package name here if you are using different application IDs
    resourcePackageName "com.testapp"
   }
}

android {
   compileSdkVersion 25
   buildToolsVersion '25.0.2'

   defaultConfig {
       applicationId "com.testapp"
       minSdkVersion 16
       targetSdkVersion 25
       versionCode 55
       versionName "5.2.0"
       // Enabling multidex support.
       multiDexEnabled true
   }

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        zipAlignEnabled true
        shrinkResources true
        ext.enableCrashlytics = true
        buildConfigField 'Boolean', 'enableCrashlytics', 'true'
    }
    debug {
        applicationIdSuffix ".debug"
    }
}

  lintOptions {
    checkReleaseBuilds false
    abortOnError false
  }
}

allprojects {
   repositories {
       jcenter()
       mavenCentral()
       maven {
          url 
         "https://oss.sonatype.org/content/repositories/snapshots/"
    }
    maven { url "http://dl.bintray.com/populov/maven" }
    maven { url "https://jitpack.io" }
 }
}

dependencies {  
  compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
      transitive = true;
  }
}

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

I have also integrated Answers to capture events. The strange thing is, that no crashes are getting reported in Fabric Dashboard. First I thought it may be issue with the proguard, so I added below lines to make sure, but still no luck. Not sure if I need to do something more for the release build.

-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

The release build is capturing and showing me all the data for number of users, events etc., but no crashes.

I had added the debug{ } buildType later, to separate the debug an release build on Fabric dashboard.

I am not sure what is going wrong.

like image 248
nibz Avatar asked Sep 06 '25 03:09

nibz


1 Answers

I was able to find out why it wasn't working. I missed this point while adding Fabric:

"Make sure the Fabric.with() line is after all other 3rd-party SDKs that set an UncaughtExceptionHandler"

I had few uncaught exception handlers after I had initialised Fabric. But what I didn't understand is why it worked for debug and not release. If it had to fail, it should have failed for both release and debug as well.

It did fix my issue, but would like to know why that could have happened.

Thanks all for your help. Appreciate it.

like image 99
nibz Avatar answered Sep 07 '25 22:09

nibz