Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AGP 8.3.2: java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalStateException: The Crashlytics build ID is missing. #5859

Closed
zsperske opened this issue Apr 11, 2024 · 5 comments

Comments

@zsperske
Copy link

After updating our AGP and Gradle versions to 8.3.2, we are now seeing:

java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalStateException: The Crashlytics build ID is missing.

No other changes made, Crashlytics has been working for years.

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@lehcar09
Copy link

Hi @zsperske, thank you for reaching out. I tried replicating the issue, however, I did not encounter the issue. Could you share the Crashlytics versions, as well as the Crashlytics Gradle version you're using? Aside from that, have you tried invalidating the cache and rebuilding the app to clean up the Gradle files?

@ulfandersson
Copy link

Had the same issue after upgrading from AGP 8.2.2 to 8.3.2 - but only in release builds.
(firebase bom 32.8.1)

Turns out it's related to resource shrinkage, our project is using "strict" resource shrinkage. (https://developer.android.com/build/shrink-code#strict-reference-checks)

See related issue #5562 and this comment:
https://issuetracker.google.com/issues/311837855#comment14
"if you use strict mode you need the keep rule"
(however, I still don't understand why the keep rule wasn't needed in 8.2.2?)

This keep.xml works for us:

<resources
    xmlns:tools="http://schemas.android.com/tools"
    tools:shrinkMode="strict"
    tools:keep="@string/com_google_firebase_crashlytics_*"/>

@zsperske
Copy link
Author

Thank you so much @ulfandersson! That keep rule did the trick.

@lehcar09 the issue @ulfandersson links (#5562) seems like it wasn't actually fixed in AGP 8.3.0-alpha16 as mentions. Is the fix as simple as adding the keep rule to Crashlytics internally?

argzdev added a commit that referenced this issue Apr 19, 2024
Proposed fix for #5859, previously regressed issue from #5562.

The issue affects both `firebase-crashlytics` and
`firebase-crashlytics-ndk. This behavior is triggered when
`isShrinkResources` is enabled and when "strict" rule. is added to
resource shrinkage. e.g.
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
    tools:shrinkMode="strict" />
```

b/311837855 advises that if strict mode is used, the keep rule is needed
for getIdentifier constants.

Simulated tests by publishing local copy of the `firebase-crashlytics`,
and `firebase-crashlytics-ndk`. Then testing with sample app variant
that includes `isShrinkResources` enabled in `build.gradle`

```
buildTypes {
    release {
            isShrinkResources = true
            isMinifyEnabled = true
    }
}
```
@rlazo
Copy link
Collaborator

rlazo commented May 16, 2024

Hi @zsperske this issue should be fixed in the latest release of crashlytics. Thanks!

@rlazo rlazo closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants