Crashlytics 未显示发布版本的崩溃 Android

Crashlytics not showing crashes for release build Android

我遇到 Crashlytics 问题。不确定我做错了什么。 我有两个 buildTypes 发布和调试如下。 Gradle 文件:

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'

我还集成了 Answers 来捕获事件。奇怪的是,Fabric Dashboard 中没有报告崩溃。首先我认为这可能是 proguard 的问题,所以我添加了下面几行以确保,但仍然没有运气。不确定我是否需要为发布版本做更多的事情。

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

发布版本正在捕获并向我显示有关用户数量、事件等的所有数据,但没有崩溃。

我后来添加了 debug{ } buildType,以便在 Fabric 仪表板上将调试和发布版本分开。

我不确定出了什么问题。

我找到了它不起作用的原因。我在添加 Fabric 时错过了这一点:

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

初始化 Fabric 后,我几乎没有未捕获的异常处理程序。 但我不明白的是为什么它适用于调试而不是发布。如果它必须失败,那么发布和调试也应该失败。

它确实解决了我的问题,但想知道为什么会发生这种情况。

感谢大家的帮助。欣赏一下。