Class Conflict between two Firebase modules.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- android, firebase, java
- Domain
- build-system, mobile
Research direction
Start with the app-level Gradle dependencies shown in the issue and compare the firebase-admin and firebase-messaging artifacts with the linked Cloud Messaging tutorial. Determine whether both modules can coexist without the duplicate com.google.firebase.messaging package; done means a documented dependency setup resolves FirebaseMessaging and exposes the tutorial's sendMulticast API.
Written by the indexing model from the issue text.
Description
Environment
This is currently the dependencies used in my app-level Gradle build script
dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.navigation:navigation-fragment:2.7.5")
implementation("androidx.navigation:navigation-ui:2.7.5")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
implementation("com.google.firebase:firebase-admin:9.2.0")
implementation("com.google.firebase:firebase-messaging:23.4.0")
}
Description
TL;DR: firebase-admin and firebase-messaging has the same classpath com.google.firebase.messaging.*, but their class's content is totally different.
Currently, I want to use both the module firebase-admin and firebase-messaging to learn about the feature Cloud Messaging, so I have installed my dependencies as above. The issue arose when I wanted to import the class FirebaseMessaging.
// Create a list containing up to 500 registration tokens.
// These registration tokens come from the client FCM SDKs.
List<String> registrationTokens = Arrays.asList(
"YOUR_REGISTRATION_TOKEN_1",
// ...
"YOUR_REGISTRATION_TOKEN_n"
);
MulticastMessage message = MulticastMessage.builder()
.putData("score", "850")
.putData("time", "2:45")
.addAllTokens(registrationTokens)
.build();
BatchResponse response = FirebaseMessaging.getInstance().sendMulticast(message);
// See the BatchResponse reference documentation
// for the contents of response.
System.out.println(response.getSuccessCount() + " messages were sent successfully");
While I was following [this tutorial] (https://firebase.google.com/docs/cloud-messaging/send-message#send-messages-to-multiple-devices) to build a send request to multiple devices, my IDE could not resolve the method sendMutlicast()
It turned out that while the imported class was com.google.firebase.messaging.FirebaseMessaging, the class was from the module firebase-messaging , which did not contain any of useful send method, rather than firebase-admin.
Is there anyway I can import the class FirebaseMessaging from firebase-admin and still keeping the two modules? I had switching the import order in Gradle file but still to no avail.
Thank you very much!
- Dominant language
- Java
- Stars
- 620
- Forks
- 305
- Avg merge
- 3h 23m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-java
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
firebase/firebase-admin-java#1231 ·
-
api: core
firebase/firebase-admin-java#1198 · 3 comments · 1 assignee ·
-
api: remoteconfig
firebase/firebase-admin-java#1196 · 1 comment · 2 assignees ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
firebase/firebase-admin-java#1192 · 3 comments ·
-
needs-triage type: feature request
Difficulty 3/5 1-2 days Newbie friendliness 45/100
firebase/firebase-admin-java#1149 · 1 comment ·
All issues in firebase/firebase-admin-java
Similar issues
-
bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
emitter:client:csharp feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100