简体   繁体   中英

espresso-contrib 3.3.0 works fine but any newer version results in build failures

We have defined the dependency androidTestImplementation("androidx.test.espresso:espresso-contrib:3.3.0") . Instrumentation tests are working fine. But when we try to update to a newer version (eg 3.4.0 or 3.5.0) we got the following error:

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: 

The report shows the following: 测试总结

I've found Android Tests: No tests found and Gradle: No tests found but none pointed me to a solution.

The following androidTestImplementation dependencies are used:

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")

Does anyone has a hint or by any chance a solution?

Check the Logcat for errors. I had a Firebase initialization error caused by the protobuf-lite update in Espresso 3.4.0. You need to exclude this module from espresso-contrib .

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

You may need to exclude that also from any other dependency that internally depends on espresso-contrib . You can do that using:

configurations {
    androidTestImplementation.exclude module: 'protobuf-lite'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM