7

I just recently integrated Crashlytics into my App. But I am having a "problem": It's always enabled.

On their page (and in various stackoverflow threads) it's said to turn it off I have to include ext.enableCrashlytics = false into my build.gradle. So my buildTypes look like the following:

buildTypes {
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-DEV"
            ext.enableCrashlytics = false
        }
        release {
            minifyEnabled false //TODO:Switch to true and add Proguard config to release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            ext.enableCrashlytics = true
        }
    }

But every time I run the debug buildType the application works without any crashes, i.e. Crashlytics.start(this) works without a crash even though I thought that it wouldn't even be compiled into the app with enableCrashlytics = false (strange "problem" to report, I know).

I want to understand why the app doesn't crash (to further improve my understanding of using the build.gradle file). And I want to understand why I can't disable Crashlytics with the gradle directive proposed by Crashlytics themselves. I know I can get rid of Crashlytics by simply not starting it (no call to Crashlytics.start(this)) but then the directive enableCrashlytics would be useless, right?

Am I missing something?

degill
  • 1,285
  • 2
  • 13
  • 19

1 Answers1

36

Mike from Crashlytics here.

ext.enableCrashlytics = false

disables sending a mapping file to our backend or generating an ID for your build, which speeds up gradle builds of those flavors.

If you want to disable Crashlytics for debug builds, then the answers from this SO question should help.

Community
  • 1
  • 1
Mike Bonnell
  • 16,181
  • 3
  • 61
  • 77
  • 1
    In my case, it does not work because my app crashes `This app relies on Crashlytics`. Release builds work fine when crashlytics is enabled – mrroboaat Mar 15 '17 at 14:20
  • Does it also not work if you use the instructions in the SO link? – Mike Bonnell Mar 15 '17 at 20:25
  • It's an old topic and I remember I deleted the debug application from crashlytics but I'm not sure that was the solution. In fact, I hope acquisition of crashlytics by google will facilitate our lives :) – mrroboaat Sep 13 '17 at 15:46