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: 4.0 RC1
- Firebase Component: Crashlytics Gradle Plugin
- Component version: 2.1.0
[REQUIRED] Step 3: Describe the problem
My project uses a combination of flavorDimensions and buildTypes to generate 4 different apps with different app IDs. To do this, I use an "applicationVariants.all" loop to process the combination of flavors and types to decide on the applicationId to use.
The problem is that the Crashlytics plugin doesn't appear to honour the result - it's extracting config from google-services.json based on the default applicationId specified within the flavorDimension, rather than the dynamically configured one.
If I don't specify an applicationId in the flavors, it appears to read the package from the AndroidManifest.xml - which also isn't correct.
I can't see any way to tell Crashlytics which applicationId to use.
Steps to reproduce:
See test gradle config extract below.
Building "productaProdRelease" will correctly use applicationId "com.producta.app".
Building "productaNightlyRelease" will also use that same applicationId when deciding which part of google-services.json to use, even thought application will be built with applicationId "com.development-producta.app.something" as set by setApplicationId().
This results in crash reports being sent (according to the logcat console) but never actually appearing on the web site (I assume because they're sent to one project, with the applicationId from a different one).
Relevant Code:
flavorDimensions "PRODUCT", "TARGET"
productFlavors {
producta {
dimension "PRODUCT"
applicationId "com.producta.app"
}
productb {
dimension "PRODUCT"
applicationId "com.productb.app"
}
nightly {
dimension "TARGET"
}
sprint {
dimension "TARGET"
}
prod {
dimension "TARGET"
}
}
buildTypes {
debug {
}
release {
}
penTest {
}
store {
}
}
applicationVariants.all { variant ->
def mergedFlavor = variant.mergedFlavor
if (variant.flavorName.startsWith("producta")) {
if (variant.flavorName.contains("Prod")) {
mergedFlavor.setApplicationId("com.producta.app")
} else {
mergedFlavor.setApplicationId("com.development-producta.app.something")
}
} else {
if (variant.flavorName.contains("Prod")) {
mergedFlavor.setApplicationId("com.productb.app")
} else {
mergedFlavor.setApplicationId("com.unrelated.app.something")
}
}
}
Activity
JonWatson commentedon May 26, 2020
Seeing the same problematic behavior, thanks in advance
mrwillis21 commentedon May 26, 2020
Hi there! Just wanted to let folks know we're aware of this issue and working on getting a fix in for it. :)
Thanks for the report!
soenkegissel commentedon Jun 8, 2020
Seeing the same problematic behavior, thanks in advance
karthikrpandian commentedon Jun 22, 2020
We are also struggling with same issue
soenkegissel commentedon Jun 22, 2020
@mrwillis21 Could you please work in this issue next? Would be so happy.
mrwillis21 commentedon Jul 8, 2020
Hi @darrentaft (and others). I've been digging a bit more into this, and I'm not sure this is actually describing the issue I'd mentioned before that we knew about. I could use a bit more information. You mentioned:
Can you give me a sense of where you're seeing the incorrect application ID being used? I know you'd mentioned that you're not seeing your crash reports being sent up, but I'd like to understand better what you mean by "it's extracting config...". Can you give me an example of your build/run process where you're seeing the incorrect behavior?
mrwillis21 commentedon Jul 8, 2020
@JonWatson, @soenkegissel, or @karthikrpandian if you have examples of how this is affecting you, that would also help. :)
JonWatson commentedon Jul 9, 2020
@mrwillis21 Do you have access to the support tickets from [email protected]? I have a case open with a lot of info.
Case 00061830
We are registering "com.foo.bar" and "com.foo.bar.zap" as the expected Application IDs in the Crashlytics console and google-services.json. The installed app has the expected Application ID of "com.foo.bar" or "com.foo.bar.zap"
In the logs, I see:
Sending app info to https://update.crashlytics.com/spi/v1/platforms/android/apps/com.foo. So however the Crashlytics SDK is determining the Application Id(Package Name), it is not respecting the variant.mergedFlavor override.soenkegissel commentedon Jul 9, 2020
@mrwillis21 I can describe my issues as the exact same as mentioned by @JonWatson.
The following will work with no problems. If I build for debug the google-services.json will search for com.company.coffeecup.debug. If this ID is not found build will fail. So everything as expected.
This will work as well. If in firebase console no com.company.coffeecup.huawei.debug or com.company.coffeecup.samsung is found, build will fail. Expected.
But here comes the problem. If I dynamically assign applicationIds with the following. Firebase (not only Crashyltics, but Analytics as well) will no honour this. It will look for e.g com.company.coffeecup.huawei.
Gradle will honour the setApplicationId function and does correctly set ID. This screenshot is from Samsung Galaxy Store Dashboard

Everything set via mergedFlavor.setApplicationId is no honoured by firebase.
In my firebase dashboard all analytics and crash reports for all editions and flavors (set via mergedFlavor.setApplicationId) is added to com.company.coffeecup.huawei instead of com.company.coffeecup.huawei.christmasedition, com.company.coffeecup.huawei.summeredition, com.company.coffeecup.huawei.kidsedition...
Hope this helps.
soenkegissel commentedon Jul 9, 2020
Use this example to test:
This example will only look for com.company.coffeecup in google-services.json. Will not throw any errors for not finding com.company.coffeecup.willnotworkfor.huawei and does register both flavours as com.company.coffeecup.
mrwillis21 commentedon Jul 17, 2020
Thanks everyone for the examples!
This is why I was asking -- I believe the problem may be broader than the Crashlytics plugin. Let me take all this info back to the team, and I'll let you know when I have more information to share. Thanks again!
soenkegissel commentedon Jul 20, 2020
Yes please take it to the team. I think there is a huge dark figure on this issue.
mrwillis21 commentedon Jul 21, 2020
Hi folks,
For those of you experiencing this issue, do you have an app created in Firebase for each of your dynamic app IDs? For example, if you have
com.foo, with two dynamic IDs:com.foo.debugandcom.foo.release- do you have separate apps in the Firebase console forcom.foo,com.foo.debug, andcom.foo.release?Also, are your apps migrated from Fabric, or newly onboarded in Firebase?
soenkegissel commentedon Jul 21, 2020
Yes
Newly in firebase
mrwillis21 commentedon Jul 29, 2020
Hello again everyone!
We believe we've tracked down the issue. It's related to the dynamically-set application ID not being picked up by the Google Services Plugin. This does cause downstream effects in Crashlytics, but also in other Firebase products, as has been shown.
While we work to determine the best solution to this problem, we've found a simple workaround, which is to apply the Google Services Plugin after setting the application IDs in your
applicationVariantsblock. So given the previous example:Try this out and let us know how it goes, and I'll let you know when we have more details to share on this. :)
vuhomobytelab commentedon Aug 21, 2020
Hi,
I followed your solution but nothing happen.
Crashlytics still get default config application ID.
Thanks.
JonWatson commentedon Aug 21, 2020
This worked for us. Certainly not ideal but I'll take it! Thanks!
mrwillis21 commentedon Nov 19, 2020
Quick update to let you know that recent versions of the Google Services Plugin should no longer require this workaround. :)