question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unstrippedNativeLibsDir property can't accomodate build type and flavor variations together

See original GitHub issue

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.6.3
  • Firebase Component: Crashlytics (Database, Firestore, Storage, Functions, etc)
  • Component version: firebase-crashlytics-ndk: 17.0.1 firebase-crashlytics-plugin: 2.1.1

[REQUIRED] Step 3: Describe the problem

We have a fairly complex project layout, so the default Crashlytics heuristics for locating the unstripped binaries do not work for us. So we have to arrange the proper file tree ourselves and then point to it using the strippedNativeLibsDir and unstrippedNativeLibsDir properties. Of course, the binaries are different depending on the build flavor and the build type, so having a common value for those properties in the defaultConfig is a no-go. We can set those properties per build type, but then the per-flavor variation is lost. If we set them per-flavor, then the per-build type variation is lost.

Steps to reproduce:

android {

    // This setup assumes the same binaries are used for all flavors
    builtTypes {
        debug {
            firebaseCrashlytics {
                strippedNativeLibsDir 'myLibs/stripped/debug'
                unstrippedNativeLibsDir 'myLibs/unstripped/debug'
            }
        }
        release {
            firebaseCrashlytics {
                strippedNativeLibsDir 'myLibs/stripped/release'
                unstrippedNativeLibsDir 'myLibs/unstripped/release'
            }
        }
    }

    // This setup assumes the same binaries are used for all build types
    flavors {
        flavorA {
            firebaseCrashlytics {
                strippedNativeLibsDir 'myLibs/stripped/flavorA'
                unstrippedNativeLibsDir 'myLibs/unstripped/flavorA'
            }
        }
        flavorB {
            firebaseCrashlytics {
                strippedNativeLibsDir 'myLibs/stripped/flavorB'
                unstrippedNativeLibsDir 'myLibs/unstripped/flavorB'
            }
        }
    }
}

So one couldn’t organize myLibs/stripped and myLibs/unstripped to hold AGP-like hierarchies with variant dirs inside. Either the build type or the flavor configuration “wins”.

Relevant Code:

Ideally, the one would be able to set a “root” directory that contains variant-dir hierarchies

android {
    defaultConfig {
        firebaseCrashlytics {
            strippedNativeLibsRootDir 'myLibs/stripped'
            unstrippedNativeLibsRootDir 'myLibs/unstripped'
        }
    }
}

Or, alternatively, at least one should be able to set those properties for each variant:

android.applicationVariants.all { variant ->
    variant.firebaseCrashlytics.strippedNativeLibsDir "myLibs/stripped/${variant.dirName}"
    variant.firebaseCrashlytics.unstrippedNativeLibsDir "myLibs/unstripped/${variant.dirName}"
}

Unfortunately, the Firebase Crashlytics extension properties are not available in the variant, so the snippet above doesn’t work.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:14
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
doganovcommented, Dec 10, 2021

I am sorry, but I do not see how multi-dimensional flavor priorities address the original issue I reported. The example code in the original report doesn’t involve multi-dimensional flavors at all.

I would like to re-open the issue as @mrichards suggests, but I don’t seem to have permissions to do it as the issue was closed by a project contributor.

2reactions
mrichardscommented, Dec 1, 2021

Hi folks, we just shipped version 2.8.1 of the Crashlytics Gradle plugin, which should (finally!) prioritize multi-dimensional flavor properties correctly.

Thank you for your patience, and please re-open the issue if you continue to experience problems with firebaseCrashlytics properties when using multiple flavor & build type combinations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure build variants | Android Developers
Creating product flavors is similar to creating build types: add them to the productFlavors block in your build configuration and include the settings...
Read more >
Firebase Android SDK Release Notes - Google
You can now use the Kotlin DSL to configure the App Distribution properties with multiple build variants (build types and product flavors) by...
Read more >
Android Product Flavors and Build Variants - The Right Software
Tutorial on Android product flavors using Android Studio and Gradle. Create multiple Android apps from same code by Android product flavors and build...
Read more >
Why are build types distinct from product flavors?
If it's "a different" application and multiple variants would be deployed to users, then perhaps it's a candidate for a product flavor. You've ......
Read more >
Build problem with multiple product flavours in new version ...
The app has 3 flavours listed as "flavorDimensions "model", "cost", ... with "Cannot find a variant matching build type and product flavors".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found