Firebase-android-sdk: Firebase Messaging 20.1.0 results in duplicate classes (Dagger) (Ref: 712)

Created on 13 Dec 2019  路  8Comments  路  Source: firebase/firebase-android-sdk

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.5.3
  • Firebase Component: Messaging
  • Component version: 20.1.0

[REQUIRED] Step 3: Describe the problem

After updating our app from Firebase Messaging version 20.0.1 to version 20.1.0 we are now receiving duplicate class errors regarding Dagger. Our app uses Dagger 1.2.5. This appears to be related the resolution of Issue 712.

Errors are as follows:

  • Duplicate class dagger.Lazy found in modules dagger-1.2.5.jar (com.squareup.dagger:dagger:1.2.5) and dagger-2.24.jar (com.google.dagger:dagger:2.24)
  • Duplicate class dagger.MembersInjector found in modules dagger-1.2.5.jar (com.squareup.dagger:dagger:1.2.5) and dagger-2.24.jar (com.google.dagger:dagger:2.24)
  • Duplicate class dagger.Module found in modules dagger-1.2.5.jar (com.squareup.dagger:dagger:1.2.5) and dagger-2.24.jar (com.google.dagger:dagger:2.24)
  • Duplicate class dagger.Provides found in modules dagger-1.2.5.jar (com.squareup.dagger:dagger:1.2.5) and dagger-2.24.jar (com.google.dagger:dagger:2.24)

Steps to reproduce:

What happened? How can we make the problem occur?

Add Dagger 1.2.5 and Firebase Messaging 20.1.0 dependencies to your app

messaging bug

Most helpful comment

@aguatno Dropping support to users stuck with Dagger 1 is a big deal, and I think this could at least be communicated in the release notes. Migrating from Dagger 1 to Dagger 2 is a huge project, but I'm not sure what you meant by:

or use of Dagger1 (using something like https://code.google.com/archive/p/jarjar/)

Would you mind going in details about this?

All 8 comments

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Thank you for reporting the issue @ThomasSunderland. Can you share your dependencies from the build.gradle file?

@aguatno

We have about 10 modules in our solution (it is quite large), but the dependencies of concern I think are below. Thanks!

    // dependency injection (dagger)
    // Ref: http://square.github.io/dagger/
    implementation "com.squareup.dagger:dagger:1.2.5"
    annotationProcessor "com.squareup.dagger:dagger-compiler:1.2.5"

    // firebase messaging (required for supporting SNS over FCM)
    // note: do not update, causes clash with Dagger
    // ref: https://github.com/firebase/firebase-android-sdk/issues/1054
    implementation 'com.google.firebase:firebase-messaging:20.0.1'

Thanks @ThomasSunderland I was able to reproduce the issue. I'll forward this information to the team. I'll be reaching out to you as soon as any information becomes available.

Hi @ThomasSunderland thanks for patiently waiting. Upon checking, it seems there's an incompatibility between the latest SDK and Dagger1. You could solve this by migrating to Dagger2 or use of Dagger1 (using something like https://code.google.com/archive/p/jarjar/). Currently, It's unlikely the team is going to switch away from Dagger2, though.

I'm going to close this issue for now. In case you want to continue the discussion just leave a comment here and we are happy to re-open this.

@aguatno Dropping support to users stuck with Dagger 1 is a big deal, and I think this could at least be communicated in the release notes. Migrating from Dagger 1 to Dagger 2 is a huge project, but I'm not sure what you meant by:

or use of Dagger1 (using something like https://code.google.com/archive/p/jarjar/)

Would you mind going in details about this?

My company also ran into this. We have a large app that's pretty locked in to Dagger 1 for the foreseeable future.

Was this page helpful?
0 / 5 - 0 ratings