NoSuchMethodError: DesugarCollections.synchronizedMap in release instrumentation tests with firebase-sessions 3.0.7 (BOM 34.x)

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

Maintainer thường phản hồi trong vòng 1 ngày

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
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, firebase, java
Lĩnh vực
build-system, mobile, testing

Hướng nghiên cứu

Bắt đầu với tệp đính kèm firebase-desugar-repro.zip và tái hiện sự cố bằng cấu hình release instrumentation-test cùng lệnh adb được liệt kê. Truy vết các phiên bản DesugarCollections xung đột giữa APK chính và APK kiểm thử; hoàn tất khi kiểm thử instrumentation release khởi chạy mà không có NoSuchMethodError.

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

Mô tả

api: sessions

Running Instrumentation tests with minify enabled release builds after updating to the 34.x from 33.x results into a NoSuchMethodError crash as soon as we launch the app in test environment.

Environment
  • Firebase BOM: 34.18.0
  • firebase-sessions: 3.0.7
  • firebase-crashlytics: 20.1.1
  • AGP: 8.13.2
  • desugar_jdk_libs: 2.1.5 (latest public)
  • testBuildType: release
  • minifyEnabled: true
Steps to reproduce:
  1. Add firebase-crashlytics (or any lib that pulls in firebase-sessions) with BOM 34.x
  2. Set minifyEnabled true in release build type
  3. Set testBuildType "release" in android block
  4. Set coreLibraryDesugaringEnabled true with desugar_jdk_libs:2.1.5
  5. Run adb shell am instrument -w -r .test/androidx.test.runner.AndroidJUnitRunner

Expected: instrumentation test runs
Actual: process crashes immediately during FirebaseInitProvider.onCreate before any test runs -

java.lang.NoSuchMethodError: No static method synchronizedMap(Ljava/util/Map;)Ljava/util/Map;
in class Lj$/util/DesugarCollections; or its super classes
(declaration of 'j$.util.DesugarCollections' appears in <package>.test apk)
    at CrashlyticsRegistrar.<clinit>
    at FirebaseInitProvider.onCreate

firebase-sessions:3.0.7 calls DesugarCollections.synchronizedMap() which was compiled against an internal desugaring library that includes this method. In a normal release build this works because Firebase's bundled DesugarCollections (with synchronizedMap) is the only one present. In release instrumentation tests, the test APK brings its own DesugarCollections from the public desugar_jdk_libs:2.1.5 (which lacks synchronizedMap) and it shadows the main APK's version, causing the crash.

Relevant Code:

Attaching a minimal repro project to reproduce this issue.

firebase-desugar-repro.zip

Ngôn ngữ chính
Java
Star
2.6k
Fork
733
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
72

Chuẩn bị môi trường

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-android-sdk

Tất cả issue của firebase/firebase-android-sdk

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.