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

オープン
#8,600 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, firebase, java

調査の方向性

添付された firebase-desugar-repro.zip から始め、記載されている release instrumentation-test 構成と adb コマンドを使ってクラッシュを再現します。メイン APK とテスト APK の間で競合している DesugarCollections のバージョンを追跡します。release instrumentation test が NoSuchMethodError なしで起動すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Java
スター
2.6k
フォーク
733
平均マージ
2日 15時間
マージ済み PR(30日)
72

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/firebase-android-sdk のほかの issue

firebase/firebase-android-sdk の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。