Skip to content

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

Open

Description

@shubham1g5

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

Activity

  1. lehcar09 commented on Sep 18, 2026

    @lehcar09
    Contributor

    Hi @shubham1g5, thank you for reaching out. I tried reproducing the issue with the MCVE you shared, however, I'm not getting the same error message as you shared.

    Image

    However, let me consult this to our engineers and get back to you.

    In the meantine, could you try to clean and invalidate the caches and see if the issue persists?

  2. shubham1g5 commented on Sep 21, 2026

    @shubham1g5
    Author

    @lehcar09 The Process Crashed in your screenshot seems to be the bug reproducing — it's just that the crash occurs pre-test so it surfaces as an instrumentation runner failure rather than a test assertion failure.

  3. lehcar09 commented on Sep 21, 2026

    @lehcar09
    Contributor

    Thank you for clarifying @shubham1g5. I'll raise this to our engineers and see what we can do here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions