"No tests found" when enabling instrumentation with Gradle (using Espresso)

2,531 views
Skip to first unread message

Sebastian Schuberth

unread,
Oct 6, 2014, 7:57:41 AM10/6/14
to adt...@googlegroups.com
Hi,

I have an app with tests defined inside the androidTest sourceSet. We're using the Espresso test framework. Running tests via connectCheck works fine. But as soon as I enable instrumentation via "testCoverageEnabled true" in my app's "debug" buildType, I get

Tests on Nexus 4 - 4.4.4 failed: Instrumentation run failed due to 'java.lang.VerifyError'

com.android.builder.testing.ConnectedDevice > hasTests[Nexus 4 - 4.4.4] FAILED
No tests found.
null
java.io.IOException: Failed to pull /data/data/<package name>/coverage.ec from device
        at com.android.builder.testing.ConnectedDevice.pullFile(ConnectedDevice.java:114)
        at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:185)
        at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.ddmlib.SyncException: Remote object doesn't exist!
        at com.android.ddmlib.SyncService.pullFile(SyncService.java:314)
        at com.android.ddmlib.Device.pullFile(Device.java:874)
        at com.android.builder.testing.ConnectedDevice.pullFile(ConnectedDevice.java:107)
        ... 8 more
:connectedAndroidTest FAILED

At first I thought this is the infamous bug in dx in conjunction with Dagger [1], but so far non of those reports were mentioning the "No tests found" error. So maybe the "Remote object doesn't exist!" error indeed is [1], but the earlier "No tests found" is something different. Any insights?

[1] https://code.google.com/p/android/issues/detail?id=69174

Regards,
Sebastian

Kevin Schultz

unread,
Oct 7, 2014, 8:52:16 AM10/7/14
to adt...@googlegroups.com
Sebastian,

I have the same issue. It appears that Espresso depends on Dagger, so you are hitting the Dex/Dagger issue you linked. I believe it has been fixed in the version of Dx shipping in Android L, so I'm looking forward to that.

許建林

unread,
Nov 14, 2014, 2:55:53 AM11/14/14
to adt...@googlegroups.com
I found a solution to this problem.
Change the dependency scope of dagger from "compile" to "provided" in your app build.grade. Also guava should make the same change if needed.

在 2014年10月6日星期一UTC+8下午7时57分41秒,Sebastian Schuberth写道:

Sebastian Schuberth

unread,
Nov 15, 2014, 2:38:14 PM11/15/14
to adt...@googlegroups.com
On Fri, Nov 14, 2014 at 8:55 AM, 許建林 <xz4...@gmail.com> wrote:

> I found a solution to this problem.
> Change the dependency scope of dagger from "compile" to "provided" in your
> app build.grade. Also guava should make the same change if needed.

In fact, this should not be an issue anymore as the bug with Dagger
has been fixed with build tools revision 21.0.0.

--
Sebastian Schuberth
Reply all
Reply to author
Forward
0 new messages