Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Class Conflict between two Firebase modules.

Đang mở
#891 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
android, firebase, java
Lĩnh vực
build-system, mobile

Hướng nghiên cứu

Bắt đầu với các dependency Gradle cấp ứng dụng được nêu trong issue và so sánh các artifact firebase-admin và firebase-messaging với tutorial Cloud Messaging được liên kết. Xác định xem cả hai module có thể cùng tồn tại mà không có package com.google.firebase.messaging bị trùng lặp hay không; hoàn thành có nghĩa là một cấu hình dependency được ghi lại có thể resolve FirebaseMessaging và cung cấp API sendMulticast của tutorial.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs-triage
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!

Ngôn ngữ chính
Java
Star
620
Fork
305
Merge trung bình
4 ngày 9 giờ
Pull request đã merge (30 ngày)
4

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/firebase-admin-java

Tất cả issue của firebase/firebase-admin-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.