Mariusz
Mariusz

Reputation: 1865

"No tests found" for instrumentation tests for Lollipop and above

My instrumentation based (espresso) tests don't run on Lollipop+ devices and emulators. They correctly run on any other platform. I have the same symptoms as the guy in this thread - https://groups.google.com/forum/?fromgroups#!topic/adt-dev/QW5SuzQizNk

I can execute a ./gradlew connectedCheck and the tests run well on a device with KitKat, but when I try to run the same tests the same way on a device with Lollipop I get...

15:02:15.784 [WARN] [org.gradle.api.Task] Tests on XT1095 - 5.1 failed: Instrumentation run failed due to 'java.lang.NoClassDefFoundError'

15:02:16.011 [WARN] [org.gradle.api.Task] com.android.builder.testing.ConnectedDevice > No tests found.[XT1095 - 5.1] FAILED

15:02:16.011 [WARN] [org.gradle.api.Task] No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).

Upvotes: 13

Views: 4117

Answers (1)

Mariusz
Mariusz

Reputation: 1865

Finally it started working. I followed this answer: https://groups.google.com/d/msg/adt-dev/QW5SuzQizNk/mWdaEuuCCQAJ which links to: https://github.com/google/dagger/issues/271

Basically this was the problem:

I incorrectly used compile 'com.google.dagger:dagger-compiler:2.0.2'

instead of correct apt 'com.google.dagger:dagger-compiler:2.0.2'

Upvotes: 4

Related Questions