Crashlytics: ext.alwaysUpdateBuildId = false erroneously applies even in other productFlavors
Asked Answered
S

0

7

This is my productFlavors definition in build.gradle:

flavorDimensions "fasterbuild", "flavor"

productFlavors {
    slow {
        dimension "fasterbuild"
        // "Slow" uses the defaultConfig minSdkVersion, currently 16
    }

    fast {
        dimension "fasterbuild"

        //Use minSdk 21, mainly to avoid legacy multidex
        minSdkVersion 21

        //Crashlytics will generate a new build id for every build.
        //This can (and should) be disabled for debug builds with a single line:
        ext.alwaysUpdateBuildId = false
    }

    dev {
        dimension "flavor"
        ...
    }

    market {
        dimension "flavor"
        ...
    }
}

This produces the following buildVariants:

build variants

(I filter out the fastMarket* combinations).

Problem

Based on the above definition, I expect Crashlytics' alwaysUpdateBuildId setting to be disabled only in fast* variants.

However, when running assembleSlowDevDebug, I still see the following:

Detected alwaysUpdateBuildId set to false while obfuscation is enabled. This may result in obfuscated stack traces in Crashlytics.

Here's more of the gradle ouput:

Executing tasks: [:app:assembleSlowDevDebug]

Configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /Users/aphex/Library/Android/sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /Users/aphex/Library/Android/sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

Jack is disabled, but one of the plugins you are using supports Java 8 language features.
Jack is disabled, but one of the plugins you are using supports Java 8 language features.
Jack is disabled, but one of the plugins you are using supports Java 8 language features.
Jack is disabled, but one of the plugins you are using supports Java 8 language features.
Jack is disabled, but one of the plugins you are using supports Java 8 language features.
Jack is disabled, but one of the plugins you are using supports Java 8 language features.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
Detected alwaysUpdateBuildId set to false while obfuscation is enabled. This may result in obfuscated stack traces in Crashlytics.
Build cache is an incubating feature.
Using directory (/Users/aphex/.gradle/caches/build-cache-1) as local build cache, push is enabled.
:app:preBuild UP-TO-DATE
:app:preSlowDevDebugBuild UP-TO-DATE
...

I've further confirmed this erroneous behavior by completely removing the ext.alwaysUpdateBuildId = false line from the fast variant and re-running assembleSlowDevDebug. The offending Detected alwaysUpdateBuildId set to false line disappears.

Question

This doesn't make any sense based on my understanding of build variants and product flavors. Is this a Gradle bug, Crashlytics/Fabric issue, or both? I'm using Gradle 3.5 and the Android tools gradle plugin 2.3.3.

Shuffleboard answered 15/6, 2017 at 0:12 Comment(3)
Hi Aphex, Todd from Fabric. Can you log to the console right before you set this method in the fast section? Run ./gradlew assemble --refresh-dependencies. Then build a different variant and let me know if you see the logging line as well as the error? Thanks!Hyperparathyroidism
I've found this approach has issues as well. If we ext.alwaysUpdateBuildId = false for debug builds, the result is when we build with ./gradlew clean assemble that all of the resulting APKs don't differentiate to crashlytics by package, and if you split packages (like any sensible person would), then crashlytics treats it as if you only have a single package.Clunk
@ToddBurner Hi, I recently dug this up and it's still happening. Would you mind jumping back on this? I set a println log message right before I set that in the fast section. It still prints out in the slow variant. I'm at a loss here, why is gradle applying settings from the fast section to slow variants?Shuffleboard

© 2022 - 2024 — McMap. All rights reserved.