问题
I want to run createDebugCoverageReport gradle task.But after run task is failing and giving below error.
java.lang.NoClassDefFoundError: dagger.shaded.auto.common.BasicAnnotationProcessor
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.support.test.internal.runner.TestLoader.doLoadClass(TestLoader.java:92)
at android.support.test.internal.runner.TestLoader.loadIfTest(TestLoader.java:113)
at android.support.test.internal.runner.TestRequestBuilder.loadClassesFromClassPath(TestRequestBuilder.java:801)
at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:747)
at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:354)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:260)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1970)
Below are the dagger dependencies used
compile 'com.google.dagger:dagger:2.4'
annotationProcessor 'com.google.dagger:dagger-compiler:2.4'
androidTestCompile 'com.google.dagger:dagger-compiler:2.4'
Please suggest, How I can remove this error.
回答1:
due what I found, it's a conflict with dagger-producers extensions - auto-value-gson works fine with dagger 2.0.2 - 2.4, but when dagger-producers (any version) is added as extra dependency to project following exception is thrown.
our problem is you are hitting the dex limit, which is different than this ticket. Make sure you're adding those dependencies to the apt config, not compile.
来源:https://stackoverflow.com/questions/42714259/error-when-generating-code-coverage-report-for-androidtest-instrumented-testcase