Aar*_*ron 5 android-testing android-espresso
我们已经定义了依赖关系androidTestImplementation("androidx.test.espresso:espresso-contrib:3.3.0")。仪器测试工作正常。但是当我们尝试更新到较新的版本(例如 3.4.0 或 3.5.0)时,我们收到以下错误:
Instrumentation did not complete:
Instrumentation code: 0
Instrumentation result bundle:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedDevShortTimeoutDebugAndroidTest'.
> There were failing tests. See the report at:
Run Code Online (Sandbox Code Playgroud)
我找到了Android Tests:没有找到测试和Gradle:没有找到测试,但没有一个给我指出解决方案。
使用以下 androidTestImplementation 依赖项:
androidTestImplementation(project(":sharedTest"))
androidTestImplementation("androidx.test:core-ktx:1.5.0")
androidTestImplementation("androidx.test:rules:1.5.0")
androidTestImplementation("androidx.test:runner:1.5.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
androidTestImplementation("androidx.test.ext:junit-ktx:1.1.4")
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.3.0")
androidTestImplementation("com.microsoft.appcenter:espresso-test-extension:1.5")
androidTestImplementation("org.mockito:mockito-android:$mockitoTestVersion")
androidTestImplementation("org.mockito.kotlin:mockito-kotlin:4.0.0")
androidTestUtil("androidx.test:orchestrator:1.4.2")
Run Code Online (Sandbox Code Playgroud)
有谁有提示或解决方案吗?
检查 Logcat 是否有错误。protobuf-lite我遇到了由 Espresso 3.4.0 更新引起的 Firebase 初始化错误。您需要从 中排除该模块espresso-contrib。
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.5.1') {
exclude module: 'protobuf-lite'
}
Run Code Online (Sandbox Code Playgroud)
您可能还需要将其从内部依赖于 的任何其他依赖项中排除espresso-contrib。您可以使用以下方法来做到这一点:
configurations {
androidTestImplementation.exclude module: 'protobuf-lite'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
684 次 |
| 最近记录: |