Repository navigation
Description
[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.
Activity
[-]unstrippedNativeLibsDir property can't accomodate build time and flavor variations together[/-][+]unstrippedNativeLibsDir property can't accomodate build type and flavor variations together[/+]kevinkokomani commentedon Jun 24, 2020
Thanks for reporting this so thoroughly! Here's an issue reported a little while back that looks very similar: #1564. So it looks like this is a known issue, though I'm not sure when the team will be able to prioritize a fix.
darrentaft commentedon Nov 17, 2020
I have a similar setup (as detailed in #1564) and have worked around it using an environment variable that I set before build and read in Gradle:
and then:
I can see that it's picking up the correct folder OK in the build output, but then it fails to find symbols in the files:
I know that the symbols are in the files, as I'm also using:
and the app bundle I'm generating includes all the relevant .dbg files - Play Store is correctly showing full stack traces. It's only Crashlytics that can't get them, and is bundling ALL my NDK-related crashes under a single banner with a useless stack trace.
Any ideas?
ened commentedon Jan 4, 2021
@kevinkokomani @TKBurner hi there, happy new year - is there a update on this issue in sight?
st0rmr1der1994 commentedon Aug 18, 2021
I can also relate to this issue.
Project has release/debug build types in combination with flavors for different app stores. I can't configure these variables dynamically to match flavor directory. Also, it will be nice to finally get rid of such code
gildor commentedon Sep 13, 2021
It looks that to properly solve this issue we need the support of new
androidComponents.onVariants(or `beforeVariant) API from AGP 7.0, so it would be possible to configure each variant Firebase properties separately, and do not work with tasks anymoreScottKitchell commentedon Oct 6, 2021
After some pain here, I've found another workaround.
You can set the paths defined in the
firebaseCrashlyticsto the parent directory like @doganov suggested (rather than to each flavor+build sub-directory), but then you also have to add a dependency to theuploadCrashlyticsSymbolFile...tasks to delete any non-relevant variant files before uploading.android { defaultConfig { firebaseCrashlytics { nativeSymbolUploadEnabled true strippedNativeLibsDir 'myLibs/stripped' unstrippedNativeLibsDir 'myLibs/unstripped' } } productFlavors { // any number of flavors and dimensions } buildTypes { // ... } applicationVariants.all { variant -> tasks."uploadCrashlyticsSymbolFile${variant.name.capitalize()}".dependsOn { delete fileTree(dir: "myLibs/stripped", exclude: variant.name) delete fileTree(dir: "myLibs/unstripped", exclude: variant.name) println("Cleaned myLibs/stripped/ and myLibs/unstripped/") } } }mrichards commentedon 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
firebaseCrashlyticsproperties when using multiple flavor & build type combinations.doganov commentedon 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.
gildor commentedon Dec 13, 2021
Completely agree, this doesn't solve the original issue. We need a way to configure different build variants with different crashlytics config