java.lang.NoSuchMethodError:没有静态方法 registerDefaultInstance 与 Firebase 性能和 Espresso 仪器测试 [英] java.lang.NoSuchMethodError: No static method registerDefaultInstance with Firebase Performance and Espresso Instrumented Tests
问题描述
当我添加 implementation 'com.google.firebase:firebase-perf-ktx:19.1.0'
时,我无法启动 espresso 检测测试(应用"方案构建正常).当我尝试开始 Espresso 测试时,我有
When I adding implementation 'com.google.firebase:firebase-perf-ktx:19.1.0'
I cannot start espresso instrumented tests ("app" scheme building ok). When I trying to start Espresso test, I have
Test running failed: Process crashed.
java.lang.NoSuchMethodError: No static method registerDefaultInstance(Ljava/lang/Class;Lcom/google/protobuf/GeneratedMessageLite;)V in class Lcom/google/protobuf/GeneratedMessageLite
但如果我要删除 implementation 'com.google.firebase:firebase-perf-ktx:19.1.0'
一切正常.如何保留 Firebase 性能库和 Espresso Instrumented 测试?
But if I'm deleting implementation 'com.google.firebase:firebase-perf-ktx:19.1.0'
everything working fine.
How to keep Firebase Performance library and Espresso Instrumented tests?
推荐答案
就我而言,它似乎是由最近更新的 androidTestImplementation 'androidx 的
我可以用这个 exclude 修复protobuf-lite:3.0.1
依赖引起的.test.espresso:espresso-contrib:3.4.0'
In my case it seems to be caused by protobuf-lite:3.0.1
dependency from recently updated androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
which I was able to fix with this exclude
androidTestImplementation (androidx.test.espresso:espresso-contrib:3.4.0'){
exclude module: "protobuf-lite"
}
如果是 KTX
testImplementation('androidx.test.espresso:espresso-contrib:3.4.0') {
exclude(module = "protobuf-lite")
}
这篇关于java.lang.NoSuchMethodError:没有静态方法 registerDefaultInstance 与 Firebase 性能和 Espresso 仪器测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!