android / android/android-test

Espresso-contrib 3.4 - protobuf-lite:3.0.1 dependency causing exception on startup when used with Firebase libraries

Open
#999 10 comments 27 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

### Description
After update from 'androidx.test.espresso:espresso-contrib:3.3.0' to 'androidx.test.espresso:espresso-contrib:3.4.0' all my instrumentation tests fail.

### Steps to Reproduce
use androidTestImplementation ('androidx.test.espresso:espresso-contrib:3.4.0')
and Firebase Analytics, Performace, Crashlytics

Run Espresso test.

### Expected Results
No exception, working tests.

### Actual Results
Exception on startup:
java.lang.NoSuchMethodError: No static method registerDefaultInstance(Ljava/lang/Class;Lcom/google/protobuf/GeneratedMessageLite;)V in class Lcom/google/protobuf/GeneratedMessageLite; or its super classes (declaration of 'com.google.protobuf.GeneratedMessageLite' appears in /data/app/~~STQIHCcHI7MbyT9nY0yblg==/cz.aldor.espresso34.test-QbLfUoHzQe8ZCBAb4Mzrlg==/base.apk)

works with this exclude

androidTestImplementation ('androidx.test.espresso:espresso-contrib:3.4.0'){
exclude module: "protobuf-lite"
}

### AndroidX Test and Android OS Versions
Tested on API 30 device and API 29 AVD.

androidTestImplementation 'androidx.test:core-ktx:1.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation ('androidx.test.espresso:espresso-contrib:3.4.0')

implementation 'com.google.firebase:firebase-analytics-ktx:19.0.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.1.0'
implementation 'com.google.firebase:firebase-perf-ktx:20.0.1'

### Link to a public git repo demonstrating the problem:
https://github.com/AlmightyCZ/Espresso_3_4_protobuf_bug

Contributor guide

Open the contributing guide

Research direction

Start with the linked public repository and reproduce the startup failure using espresso-contrib 3.4.0 together with the listed Firebase libraries on the reported Android versions. Compare the 3.3.0 and 3.4.0 dependency sets and verify that instrumentation tests start without requiring the protobuf-lite exclusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, firebase
Domain
build-system, mobile, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.