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

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/annotations/concurrent/Background; #4683

Closed
mrober opened this issue Feb 15, 2023 · 1 comment

Comments

@mrober
Copy link
Contributor

mrober commented Feb 15, 2023

Note this issue can only happen in apps that do not use the Firebase Android BoM to control library versioning.

An outdated dependency on firebase-common causes an app to crash on launch if the app depends on any of the following libraries and versions (released February 09, 2023):

  • com.google.firebase:firebase-crashlytics:18.3.4
  • com.google.firebase:firebase-crashlytics-ktx:18.3.4
  • com.google.firebase:firebase-crashlytics-ndk:18.3.4
  • com.google.firebase:firebase-installations:17.1.1
  • com.google.firebase:firebase-installations-ktx:17.1.1
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/annotations/concurrent/Background
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.annotations.concurrent.Background"

This will be fixed in the next Firebase SDK release, which is being worked on now. Until that release is available, here are two workarounds:

  • Option 1: Depend on the Firebase Android BoM and drop the explicit version from the library. For example:

    implementation platform('com.google.firebase:firebase-bom:31.2.1')
    implementation 'com.google.firebase:firebase-crashlytics'
    

    This will allow the Firebase BoM to control library versioning. Note that using the Firebase BoM is the recommended way to control Firebase library versions.

  • Option 2: Add the current version of firebase-common as an explicit dependency. For example:

    implementation 'com.google.firebase:firebase-crashlytics:18.3.4'
    implementation 'com.google.firebase:firebase-common:20.3.0'
    

    This will resolve the issue while still allowing explicit control of library versions.

Either of these workarounds will work for this release. We will post an update to this issue when the next release is available.

@alexsinger
Copy link

This issue has been resolved with the following releases which are now live:

com.google.firebase:firebase-crashlytics:18.3.5
com.google.firebase:firebase-crashlytics-ktx:18.3.5
com.google.firebase:firebase-crashlytics-ndk:18.3.5
com.google.firebase:firebase-installations:17.1.2
com.google.firebase:firebase-installations-ktx:17.1.2

It is safe to update these dependencies and remove the above workarounds, if needed. Note that using the Firebase BoM is the recommended way to control Firebase library versions (the latest BoM is v31.2.2).

@firebase firebase locked and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants