Crashlytics not showing crashes for release build Android

馋奶兔 提交于 2019-12-02 08:06:17

问题


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. Can someone help me please.

Thank you, Sneha


回答1:


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.



来源:https://stackoverflow.com/questions/44771420/crashlytics-not-showing-crashes-for-release-build-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!