After upgrading Espresso to version 2 none of my unit tests will run on pre-lollipop devices. See the trace below:
15:07:07.627 [WARN] [org.gradle.api.Project] Tests on Samsung Galaxy S3 - 4.3 - API 18 - 720x1280 - 4.3 failed: Instrumentation run failed due to 'java.lang.IllegalAccessError'
15:07:07.832 [WARN] [org.gradle.api.Project]
com.android.builder.testing.ConnectedDevice > hasTests[Samsung Galaxy S3 - 4.3 - API 18 - 720x1280 - 4.3] FAILED
15:07:07.832 [WARN] [org.gradle.api.Project] No tests found.
15:07:07.834 [DEBUG] [org.gradle.api.Project] DeviceConnector 'Samsung Galaxy S3 - 4.3 - API 18 - 720x1280 - 4.3': uninstalling com.nordstrom.fla.test
15:07:08.252 [DEBUG] [org.gradle.api.Project] DeviceConnector 'Samsung Galaxy S3 - 4.3 - API 18 - 720x1280 - 4.3': uninstalling com.nordstrom.fla
15:07:08.666 [INFO] [org.gradle.api.Project] deleteDir(/Users/graemeharnish/workspace/fla-android/app/build/outputs/reports/androidTests/connected) returned: true
15:07:08.702 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:connectedAndroidTest'
15:07:08.702 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :app:connectedAndroidTest FAILED
The stack trace is equally unhelpful
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:connectedAndroidTest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
My gradle dependencies
dependencies {
apt "org.robobinding:codegen:$robobindingVersion"
compile "org.robobinding:robobinding:$robobindingVersion:with-aop"
aspectPath("org.robobinding:robobinding:$robobindingVersion:with-aop")
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
provided 'com.android.support:appcompat-v7:21.0.3'
compile 'net.hockeyapp.android:HockeySDK:3.5.0-b.4'
compile 'me.dm7.barcodescanner:zbar:1.5'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.squareup:otto:1.3.5'
compile 'org.apache.commons:commons-lang3:3.0'
compile 'com.nispok:snackbar:2.8.0'
compile 'com.rengwuxian.materialedittext:library:1.8.0'
compile 'com.crittercism:crittercism-android-agent:+'
provided 'org.roboguice:roboblender:3.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.melnykov:floatingactionbutton:1.1.0'
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.android.support:support-annotations:21.0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.0'
androidTestCompile('org.mockito:mockito-core:1.9.5',
'com.google.dexmaker:dexmaker-mockito:1.1',
'com.google.dexmaker:dexmaker:1.1')
}
What's strange is it work on 5.0 devices no problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…